Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys CID 976378: Avoid incorrect computation with ngrps == 0



details:   https://anonhg.NetBSD.org/src/rev/4a31ec88a026
branches:  trunk
changeset: 796307:4a31ec88a026
user:      christos <christos%NetBSD.org@localhost>
date:      Wed May 28 14:55:16 2014 +0000

description:
CID 976378: Avoid incorrect computation with ngrps == 0

diffstat:

 sys/sys/socket.h |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r 5bab8f2903b0 -r 4a31ec88a026 sys/sys/socket.h
--- a/sys/sys/socket.h  Wed May 28 14:49:28 2014 +0000
+++ b/sys/sys/socket.h  Wed May 28 14:55:16 2014 +0000
@@ -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 @@
  * 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 */
 
 



Home | Main Index | Thread Index | Old Index