Skip to content

Commit 7318cc4

Browse files
committed
also fixed a different buffer
1 parent 358e957 commit 7318cc4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/fread.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2530,18 +2530,18 @@ int freadMain(freadMainArgs _args) {
25302530
// Can't print because we're likely not master. So accumulate message and print afterwards.
25312531
if (thisType < joldType) { // thisType<0 (type-exception)
25322532
if (verbose) {
2533-
char temp[1001];
2534-
int len = snprintf(temp, 1000,
2533+
char buffer[250];
2534+
int len = snprintf(buffer, sizeof(buffer),
25352535
_("Column %d%s%.*s%s bumped from '%s' to '%s' due to <<%.*s>> on row %"PRId64"\n"),
25362536
j+1, colNames?" <<":"", colNames?(colNames[j].len):0, colNames?(colNamesAnchor+colNames[j].off):"", colNames?">>":"",
25372537
typeName[IGNORE_BUMP(joldType)], typeName[IGNORE_BUMP(thisType)],
25382538
(int)(tch-fieldStart), fieldStart, (int64_t)(ctx.DTi+myNrow));
2539-
if (len > 1000) len = 1000;
2540-
if (len > 0) {
2541-
typeBumpMsg = realloc(typeBumpMsg, typeBumpMsgSize + len + 1);
2542-
strcpy(typeBumpMsg+typeBumpMsgSize, temp);
2543-
typeBumpMsgSize += len;
2544-
}
2539+
2540+
len = min(len, sizeof(buffer));
2541+
2542+
typeBumpMsg = realloc(typeBumpMsg, typeBumpMsgSize + len + 1);
2543+
strcpy(typeBumpMsg+typeBumpMsgSize, buffer);
2544+
typeBumpMsgSize += len;
25452545
}
25462546
nTypeBump++;
25472547
if (joldType>0) nTypeBumpCols++;

0 commit comments

Comments
 (0)