Skip to content
Snippets Groups Projects
Commit c8634c7a authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

SAFECOPY (now using strlcpy) requires the source is terminated

... so use strncpy() and TERMINATE() here (instead of SAFECOPY) to resolve
newly reported Coverity issues.

There may be other places where we're using SAFECOPY() with an unterminated
source string that would've been fine before we switched SAFECOPY from using
strncpy to strlcpy. So we should reconsider that change.
parent 4c7a908f
No related branches found
No related tags found
1 merge request!455Update branch with changes from master
Pipeline #6271 failed
......@@ -56,10 +56,10 @@ bool sauce_fread_charinfo(FILE* fp, enum sauce_char_filetype* type, struct sauce
*type = record.filetype;
if(info != NULL) {
memset(info, 0, sizeof(*info));
SAFECOPY(info->title, record.title); truncsp(info->title);
SAFECOPY(info->author, record.author); truncsp(info->author);
SAFECOPY(info->group, record.group); truncsp(info->group);
SAFECOPY(info->date, record.date); truncsp(info->date);
strncpy(info->title, record.title, sizeof info->title); TERMINATE(info->title); truncsp(info->title);
strncpy(info->author, record.author, sizeof info->author); TERMINATE(info->author); truncsp(info->author);
strncpy(info->group, record.group, sizeof info->group); TERMINATE(info->group); truncsp(info->group);
strncpy(info->date, record.date, sizeof info->date); TERMINATE(info->date); truncsp(info->date);
info->width = record.tinfo1;
info->height = record.tinfo2;
switch(record.filetype) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment