'Warnings' produced when compiling
adde88 opened this issue · 1 comments
adde88 commented
Afaik. these warnings doesn't actually cause any errors when running the compiled binary.
It also seems that compiling using gcc version 4.8 displays no warnings, so i wouldn't name this "high priority" or anything. Just a friendly heads up. 😄
file2pcap.c: In function ‘ftp’:
file2pcap.c:626:53: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
snprintf(hoFtp.srcFile, sizeof(hoFtp.srcFile)-1,"%s", ho->srcFile);
^
file2pcap.c:626:2: note: ‘snprintf’ output between 1 and 200 bytes into a destination of size 199
snprintf(hoFtp.srcFile, sizeof(hoFtp.srcFile)-1,"%s", ho->srcFile);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
file2pcap.c:629:54: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
snprintf(hoFtp.dstFile, sizeof(hoFtp.dstFile)-1,"%s", ho->dstFile);
^
file2pcap.c:629:3: note: ‘snprintf’ output between 1 and 200 bytes into a destination of size 199
snprintf(hoFtp.dstFile, sizeof(hoFtp.dstFile)-1,"%s", ho->dstFile);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ftp.c: In function ‘ftpCommandsStartActive’:
ftp.c:62:42: warning: ‘
’ directive output may be truncated writing 2 bytes into a region of size between 0 and 199 [-Wformat-truncation=]
snprintf(buffer, sizeof(buffer)-1, "%s%s\r\n", retr, ho->srcFile);
^~~~
ftp.c:62:2: note: ‘snprintf’ output 3 or more bytes (assuming 202) into a destination of size 199
snprintf(buffer, sizeof(buffer)-1, "%s%s\r\n", retr, ho->srcFile);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ftp.c: In function ‘ftpCommandsStartPassive’:
ftp.c:116:42: warning: ‘
’ directive output may be truncated writing 2 bytes into a region of size between 0 and 199 [-Wformat-truncation=]
snprintf(buffer, sizeof(buffer)-1, "%s%s\r\n", retr, ho->srcFile);
^~~~
ftp.c:116:2: note: ‘snprintf’ output 3 or more bytes (assuming 202) into a destination of size 199
snprintf(buffer, sizeof(buffer)-1, "%s%s\r\n", retr, ho->srcFile);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
helpers.c: In function ‘transferFileBase64’:
helpers.c:176:25: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if(bufferspace != 1200)
^~
helpers.c:178:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
memset(buffer, 0, sizeof(buffer));
^~~~~~
helpers.c: In function ‘transferFileUU’:
helpers.c:229:25: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if(bufferspace != 620)
^~
helpers.c:231:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
memset(buffer, 0, sizeof(buffer));
^~~~~~
Compiled by gcc version 7.3.0 (Debian 7.3.0-21)
Talos-Martin commented
I got rid of a good number of those warnings in the latest version. The remaining ones don't really make sense imho. They are complaints about f.ex. copying max 199 bytes into a 200 byte buffer. That should really be ok(famous last words). If I'm mistaken, let me know.