Skip to content

Commit ac49e3d

Browse files
committed
Fix GCC >=8.0 warning: -Wstringop-truncation
1 parent 940d074 commit ac49e3d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,11 @@ im_printf(char *str, struct tm *tm,
700700
strncat(ret, c, 1);
701701
break;
702702
}
703-
} else
704-
strncat(ret, c, 1);
703+
} else {
704+
const size_t len = strlen(ret);
705+
ret[len] = *c;
706+
ret[len + 1] = '\0';
707+
}
705708
}
706709
return gib_estrdup(ret);
707710
}

0 commit comments

Comments
 (0)