Coverity CID 716: Fix query size vs return results initialization.
This commit is contained in:
parent
e073deb555
commit
10c2c730a5
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uipc_domain.c,v 1.55 2005/12/08 03:10:12 thorpej Exp $ */
|
||||
/* $NetBSD: uipc_domain.c,v 1.56 2006/04/15 04:41:52 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.55 2005/12/08 03:10:12 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.56 2006/04/15 04:41:52 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -254,19 +254,24 @@ sysctl_unpcblist(SYSCTLFN_ARGS)
|
|||
if (namelen != 4)
|
||||
return (EINVAL);
|
||||
|
||||
if (oldp != NULL) {
|
||||
len = *oldlenp;
|
||||
elem_size = name[2];
|
||||
elem_count = name[3];
|
||||
if (elem_size != sizeof(pcb))
|
||||
return EINVAL;
|
||||
} else {
|
||||
len = 0;
|
||||
elem_size = sizeof(pcb);
|
||||
elem_count = INT_MAX;
|
||||
}
|
||||
error = 0;
|
||||
dp = oldp;
|
||||
len = (oldp != NULL) ? *oldlenp : 0;
|
||||
op = name[0];
|
||||
arg = name[1];
|
||||
elem_size = name[2];
|
||||
elem_count = name[3];
|
||||
out_size = MIN(sizeof(pcb), elem_size);
|
||||
out_size = elem_size;
|
||||
needed = 0;
|
||||
|
||||
elem_count = INT_MAX;
|
||||
elem_size = out_size = sizeof(pcb);
|
||||
|
||||
if (name - oname != 4)
|
||||
return (EINVAL);
|
||||
|
||||
|
|
Loading…
Reference in New Issue