This warning is reported by cppcheck:
check-qdict.c:270: warning: scanf without field width limits can crash with huge input data
Fix it by limiting the field widths to 127 (both key and value take
127 characters + a terminating '\0' byte).
Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
{
char value[128];
- if (fscanf(file, "%s%s", key, value) == EOF)
+ if (fscanf(file, "%127s%127s", key, value) == EOF) {
return NULL;
+ }
remove_dots(key);
return qstring_from_str(value);
}