Module Name: src
Committed By: christos
Date: Wed Nov 27 20:40:48 UTC 2013
Modified Files:
src/sbin/gpt: map.c
Log Message:
CID 1132762: Add error check for negative, to make zero-divide in module
impossible.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sbin/gpt/map.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/gpt/map.c
diff -u src/sbin/gpt/map.c:1.5 src/sbin/gpt/map.c:1.6
--- src/sbin/gpt/map.c:1.5 Wed Nov 20 03:08:47 2013
+++ src/sbin/gpt/map.c Wed Nov 27 15:40:48 2013
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/map.c,v 1.6 2005/08/31 01:47:19 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: map.c,v 1.5 2013/11/20 08:08:47 jnemeth Exp $");
+__RCSID("$NetBSD: map.c,v 1.6 2013/11/27 20:40:48 christos Exp $");
#endif
#include <sys/types.h>
@@ -194,6 +194,10 @@ map_resize(map_t *m, off_t size, off_t a
n = m->map_next;
+ if (size < 0 || alignment < 0) {
+ warnx("negative size or alignment");
+ return 0;
+ }
if (size == 0 && alignment == 0) {
if (n == NULL || n->map_type != MAP_TYPE_UNUSED)
return 0;