diff options
author | Stefan Weil <weil@mail.berlios.de> | 2011-01-21 22:50:30 +0100 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2011-02-20 18:45:09 +0100 |
commit | 7464f0587b2938a3e10e9f995f384df8a5f298ac (patch) | |
tree | 8485d320bf2091c7e14d61b44fd6f9d5efcbfaad | |
parent | 8da91fffeaffba5f014dfdcc88b672590e83b7fc (diff) |
check-qdict: Fix possible crash
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 <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
-rw-r--r-- | check-qdict.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/check-qdict.c b/check-qdict.c index 6afce5a5ca..ecc7fd7b90 100644 --- a/check-qdict.c +++ b/check-qdict.c @@ -267,8 +267,9 @@ static QString *read_line(FILE *file, char *key) { 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); } |