From 130b0821219b9e5237cbadd492ddd171294d7cab Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Fri, 30 Nov 2012 10:54:40 +0000 Subject: [PATCH] Fix buffer overflows in df(1), format(1) --- commands/df/df.c | 3 ++- commands/format/format.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/df/df.c b/commands/df/df.c index 244ead4dc..be07620b8 100644 --- a/commands/df/df.c +++ b/commands/df/df.c @@ -109,7 +109,8 @@ static void readmtab(const char *type) { struct mtab **amt= &mtab, *new; struct stat st; - char devname[128], mountpoint[128], version[10], rw_flag[10]; + char devname[PATH_MAX], mountpoint[PATH_MAX], version[MNTNAMELEN], + rw_flag[MNTFLAGLEN]; if (load_mtab("df") < 0) exit(1); diff --git a/commands/format/format.c b/commands/format/format.c index f5fbbfb28..3c9ccaa5b 100644 --- a/commands/format/format.c +++ b/commands/format/format.c @@ -290,7 +290,7 @@ int main(int argc, char **argv) int verify= 0; struct stat st0, st; char special[PATH_MAX + 1], mounted_on[PATH_MAX + 1]; - char version[10], rw_flag[10]; + char version[MNTNAMELEN], rw_flag[MNTFLAGLEN]; /* Option -v. */ while (argc > 1 && argv[1][0] == '-') {