mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-28 11:57:28 +00:00
Fix two accesses to uninitialized variables that a revision 1.27
has introduced. Found with: Coverity Prevent(tm)
This commit is contained in:
parent
39550088cf
commit
4006cd2b3f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=154521
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user