summaryrefslogtreecommitdiffstats
path: root/sys-utils/readprofile.c
diff options
context:
space:
mode:
authorBoris Egorov2016-01-19 06:45:15 +0100
committerBoris Egorov2016-01-19 07:59:12 +0100
commit01b63fcca2908fe72c0577205bc731b3f0d9a849 (patch)
tree4866119387ea385f30b0ab33d63e06acc3219c2d /sys-utils/readprofile.c
parentlibblkid,libmount: Do not use void* in calculations [cppcheck] (diff)
downloadkernel-qcow2-util-linux-01b63fcca2908fe72c0577205bc731b3f0d9a849.tar.gz
kernel-qcow2-util-linux-01b63fcca2908fe72c0577205bc731b3f0d9a849.tar.xz
kernel-qcow2-util-linux-01b63fcca2908fe72c0577205bc731b3f0d9a849.zip
readprofile: add scanf field width limits [cppcheck]
[sys-utils/readprofile.c:301]: (warning) scanf without field width limits can crash with huge input data. [sys-utils/readprofile.c:322]: (warning) scanf without field width limits can crash with huge input data.
Diffstat (limited to 'sys-utils/readprofile.c')
-rw-r--r--sys-utils/readprofile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c
index 3ba866e24..39a24deda 100644
--- a/sys-utils/readprofile.c
+++ b/sys-utils/readprofile.c
@@ -298,7 +298,7 @@ int main(int argc, char **argv)
err(EXIT_FAILURE, "%s", mapFile);
while (fgets(mapline, S_LEN, map)) {
- if (sscanf(mapline, "%llx %s %s", &fn_add, mode, fn_name) != 3)
+ if (sscanf(mapline, "%llx %7[^\n ] %127[^\n ]", &fn_add, mode, fn_name) != 3)
errx(EXIT_FAILURE, _("%s(%i): wrong map line"), mapFile,
maplineno);
/* only elf works like this */
@@ -319,7 +319,7 @@ int main(int argc, char **argv)
unsigned int this = 0;
int done = 0;
- if (sscanf(mapline, "%llx %s %s", &next_add, mode, next_name) != 3)
+ if (sscanf(mapline, "%llx %7[^\n ] %127[^\n ]", &next_add, mode, next_name) != 3)
errx(EXIT_FAILURE, _("%s(%i): wrong map line"), mapFile,
maplineno);
header_printed = 0;