summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorjh <jh@FreeBSD.org>2012-07-17 09:34:52 +0000
committerjh <jh@FreeBSD.org>2012-07-17 09:34:52 +0000
commiteaa7ddfd7341e05c8953e630a4d9429fdd78b127 (patch)
treed38ad101f9da94e8161c33a718606dfe93a9930c /usr.sbin
parent76909020e0bcf387498081c0bb4e052f1558550c (diff)
downloadFreeBSD-src-eaa7ddfd7341e05c8953e630a4d9429fdd78b127.zip
FreeBSD-src-eaa7ddfd7341e05c8953e630a4d9429fdd78b127.tar.gz
Make sure that arraysz is initialized to a value larger than zero.
arraysz could get initialized to zero on ZFS because ZFS reports directory sizes differently compared to UFS. PR: bin/169493 Tested by: swills MFC after: 2 weeks
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/lpr/common_source/common.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c
index 9b87dfa..c9c276d 100644
--- a/usr.sbin/lpr/common_source/common.c
+++ b/usr.sbin/lpr/common_source/common.c
@@ -139,6 +139,8 @@ getq(const struct printer *pp, struct jobqueue *(*namelist[]))
* and dividing it by a multiple of the minimum size entry.
*/
arraysz = (stbuf.st_size / 24);
+ if (arraysz < 16)
+ arraysz = 16;
queue = (struct jobqueue **)malloc(arraysz * sizeof(struct jobqueue *));
if (queue == NULL)
goto errdone;
OpenPOWER on IntegriCloud