A quick test suggests I can't just replace sprintf with snprintf.
Original error:
src/elogd.c:4503:4: note: ‘sprintf’ output between 1 and 542 bytes into a destination of size 256 [-Wformat-overflow=]
sprintf(file_name, "%s%s%s", lbs->data_dir, lbs->el_index[index].subdir, lbs->el_index[index].file_name);
^~
New error:
src/elogd.c:4503:24: warning: passing argument 2 of ‘snprintf’ makes integer from pointer without a cast [-Wint-conversion]
snprintf(file_name, "%s%s%s", lbs->data_dir, lbs->el_index[index].subdir, lbs->el_index[index].file_name);
^~~~~~~~
In file included from src/elogd.h:42:0,
from src/elogd.c:38:
/usr/include/stdio.h:340:12: note: expected ‘size_t {aka long unsigned int}’ but argument is of type ‘char *’
extern int snprintf (char *__restrict __s, size_t __maxlen,
Allen Tuttle wrote: |
I would like to try the new code, I don't see it on elog/download/tar/.
Do you keep updates elsewhere like on get or sourceforge?
Stefan Ritt wrote: |
This warning is triggered by the use of the sprintf() funciton, which can write beyond the boundary of the destination string. I replaced it by snprintf(), which should make the compiler happy. Code is committed. Unfortuantely I have no FC27 here, so if there is still some waring with the current code, please post the full warning list here.
Stefan
|
|
|