svn commit: r238547 - head/usr.sbin/lpr/common_source

Jaakko Heinonen jh at FreeBSD.org
Tue Jul 17 09:34:53 UTC 2012


Author: jh
Date: Tue Jul 17 09:34:52 2012
New Revision: 238547
URL: http://svn.freebsd.org/changeset/base/238547

Log:
  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

Modified:
  head/usr.sbin/lpr/common_source/common.c

Modified: head/usr.sbin/lpr/common_source/common.c
==============================================================================
--- head/usr.sbin/lpr/common_source/common.c	Tue Jul 17 09:31:05 2012	(r238546)
+++ head/usr.sbin/lpr/common_source/common.c	Tue Jul 17 09:34:52 2012	(r238547)
@@ -139,6 +139,8 @@ getq(const struct printer *pp, struct jo
 	 * 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;


More information about the svn-src-all mailing list