From 047ec698d490507da52634566a5b555fbebef718 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 29 Apr 2009 14:33:52 +0200 Subject: sfdisk: fix possible buffer overflow Signed-off-by: Karel Zak --- fdisk/sfdisk.c | 9 +++++---- 1 file 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); -- cgit v1.2.3-55-g7522