Module Name:    src
Committed By:   christos
Date:           Wed May 28 14:55:16 UTC 2014

Modified Files:
        src/sys/sys: socket.h

Log Message:
CID 976378: Avoid incorrect computation with ngrps == 0


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/sys/socket.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/socket.h
diff -u src/sys/sys/socket.h:1.109 src/sys/sys/socket.h:1.110
--- src/sys/sys/socket.h:1.109	Thu Apr 17 12:14:22 2014
+++ src/sys/sys/socket.h	Wed May 28 10:55:16 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: socket.h,v 1.109 2014/04/17 16:14:22 christos Exp $	*/
+/*	$NetBSD: socket.h,v 1.110 2014/05/28 14:55:16 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -341,7 +341,8 @@ struct sockcred {
  * Compute size of a sockcred structure with groups.
  */
 #define	SOCKCREDSIZE(ngrps) \
-	(sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1)))
+	(sizeof(struct sockcred) + (sizeof(gid_t) * \
+	    ((ngrps) ? ((ngrps) - 1) : 0)))
 #endif /* _NETBSD_SOURCE */
 
 

Reply via email to