diff options
author | Karel Zak | 2009-04-29 14:33:52 +0200 |
---|---|---|
committer | Karel Zak | 2009-04-29 14:33:52 +0200 |
commit | 047ec698d490507da52634566a5b555fbebef718 (patch) | |
tree | 5a1e3fcdcbd94d4816006724254bfc3af8ac6392 | |
parent | fdisk: fix max. ptname (diff) | |
download | kernel-qcow2-util-linux-047ec698d490507da52634566a5b555fbebef718.tar.gz kernel-qcow2-util-linux-047ec698d490507da52634566a5b555fbebef718.tar.xz kernel-qcow2-util-linux-047ec698d490507da52634566a5b555fbebef718.zip |
sfdisk: fix possible buffer overflow
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | fdisk/sfdisk.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c index 2cda03ceb..da779aa89 100644 --- a/fdisk/sfdisk.c +++ b/fdisk/sfdisk.c @@ -2432,14 +2432,15 @@ is_ide_cdrom_or_tape(char *device) { static char * nextproc(FILE *procf) { - static char devname[120]; - char line[100], ptname[100]; - int ma, mi, sz; + static char devname[256]; + char line[1024], ptname[128]; + int ma, mi; + unsigned long long sz; if (procf == NULL) return NULL; while (fgets(line, sizeof(line), procf) != NULL) { - if (sscanf (line, " %d %d %d %[^\n ]", + if (sscanf (line, " %d %d %llu %128[^\n ]", &ma, &mi, &sz, ptname) != 4) continue; snprintf(devname, sizeof(devname), "/dev/%s", ptname); |