From 955b7c771a3a045b81a815cfc786fbed297b2ee2 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Fri, 4 Aug 2006 13:47:52 +0000 Subject: [PATCH] Fix buffer sizing issue for large pagesize systems, affecting mkfs auto-device-type-detection heuristics. Merge of master-melb:xfs-cmds:26662a by kenmcd. --- doc/CHANGES | 4 ++++ libdisk/fstype.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/CHANGES b/doc/CHANGES index 0fb89a412..dd8dd725d 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,3 +1,7 @@ +[cvs] + - Fix buffer sizing issue for large pagesize systems, + affecting mkfs auto-device-type-detection heuristics. + xfsprogs-2.8.9 (18 July 2006) - Fix rpm issue with install targets as uid/gid zero (we now using symbolic names rather than the numeric versions). diff --git a/libdisk/fstype.c b/libdisk/fstype.c index 225e072f2..0470b7506 100644 --- a/libdisk/fstype.c +++ b/libdisk/fstype.c @@ -383,10 +383,13 @@ fstype(const char *device) { if (!type) { /* perhaps the user tries to mount the swap space - on a new disk; warn her before she does mke2fs on it */ + on a new disk; warn her before she does mkfs on it */ int pagesize = getpagesize(); int rd; - char buf[32768]; + char buf[128 * 1024]; /* 64k is current max pagesize */ + + if (pagesize > sizeof(buf)) + abort(); rd = pagesize; if (rd < 8192) -- 2.47.2