Closed AliceLR closed 1 year ago
marchive.c:280:
strncpy
warning should have been suppressed but wasn't.
Two other uses of strncpy
in filename2short
versions at lines
252 and 281 need the same change.
mconfedit.c:374: egregious usage of
strcat
/strncat
.
This gives me headaches, but should be OK I think
mwindow.c:612: bizarre bounding of
strncpy
length on the source string which is better suited to a function that doesn't suck (snprintf
).
If msg is NULL, the result will be undefined behavior: https://stackoverflow.com/questions/11589342
Two other uses of
strncpy
infilename2short
versions at lines 252 and 281 need the same change.
Done.
If msg is NULL, the result will be undefined behavior: https://stackoverflow.com/questions/11589342
I think the diff obfuscated this, but it is still guarded by if (msg) { ... }
.
If msg is NULL, the result will be undefined behavior: https://stackoverflow.com/questions/11589342
I think the diff obfuscated this, but it is still guarded by
if (msg) { ... }
.
I was confused by the fact that there is no else
case anymore but the
code keeps calculating strlen(status_message)
down below: but that is
what the old code did, yes? In that case, I guess it's OK.
This is in now. Thanks.
Please CAREFULLY review and test these warning fixes for the MikMod player. They seem fine to me and I encountered no issues in the affected parts of the UI.
int
s. Doesn't matter in practice, but it costs nothing to make these slightly bigger.strlen(...) + strlen(...)
confused GCC into somehow thinking the two fields could be long enough to cause truncation. Replacing these witharchivelen
,filelen
, and movingfilelen
to the right side of the compare seems to fix it.int
subtraction of two unsigned bytes can result in a 4-byte long string, potentially causing truncation.tmpfmt
was slightly too short for one of thesprintf
format strings.strncpy
warning should have been suppressed but wasn't.strcat
/strncat
.strncpy
length on the source string which is better suited to a function that doesn't suck (snprintf
).Side note: for affected old MSVCs and MINGWs without the stdio wrappers for
snprintf
, the macroSNPRINTF
should probably have a safety wrapper. Same forHAVE_VSNPRINTF
, but also the case whenHAVE_VSNPRINTF
isn't defined looks really bad.