summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2006-01-18 16:09:00 +0000
committerru <ru@FreeBSD.org>2006-01-18 16:09:00 +0000
commit2eca910c1ec4e04933917087e3f534571466bd30 (patch)
treed8de5e97fca33205245de090978c82d9fd31a9a7
parent175b38b9db1d424471b6a9d63269495d4766e56f (diff)
downloadFreeBSD-src-2eca910c1ec4e04933917087e3f534571466bd30.zip
FreeBSD-src-2eca910c1ec4e04933917087e3f534571466bd30.tar.gz
Fix two accesses to uninitialized variables that a revision 1.27
has introduced. Found with: Coverity Prevent(tm)
-rw-r--r--sys/netgraph/ng_parse.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/netgraph/ng_parse.c b/sys/netgraph/ng_parse.c
index 5dd7568..2e9a365 100644
--- a/sys/netgraph/ng_parse.c
+++ b/sys/netgraph/ng_parse.c
@@ -800,10 +800,12 @@ ng_fixedstring_parse(const struct ng_parse_type *type,
int len;
int slen;
- if (slen + 1 > fi->bufSize)
- return (E2BIG);
if ((sval = ng_get_string_token(s, off, &len, &slen)) == NULL)
return (EINVAL);
+ if (slen + 1 > fi->bufSize) {
+ FREE(sval, M_NETGRAPH_PARSE);
+ return (E2BIG);
+ }
*off += len;
bcopy(sval, buf, slen);
FREE(sval, M_NETGRAPH_PARSE);
@@ -901,10 +903,12 @@ ng_sizedstring_parse(const struct ng_parse_type *type,
int len;
int slen;
- if (slen > USHRT_MAX)
- return (EINVAL);
if ((sval = ng_get_string_token(s, off, &len, &slen)) == NULL)
return (EINVAL);
+ if (slen > USHRT_MAX) {
+ FREE(sval, M_NETGRAPH_PARSE);
+ return (EINVAL);
+ }
*off += len;
*((u_int16_t *)buf) = (u_int16_t)slen;
bcopy(sval, buf + 2, slen);
OpenPOWER on IntegriCloud