diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-08-01 23:15:29 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-08-01 23:15:29 -0700 |
commit | 02f145f175894399fed33992e4e7e5a87d7e7a2a (patch) | |
tree | ddce25d13c980ce7af7ce452e31bce3e911bd284 /handle.c | |
parent | e320555a2281ff6b5ad9409480a62c976a289dc1 (diff) |
Avoid null pointer use if malloc() fails
Error: Null pointer dereference (CWE 476)
Read from null pointer str
at line 282 of handle.c in function 'parse_number'.
Function copy_to_scratch may return constant 'NULL' at line 98,
called at line 875 in function 'do_pointer'.
Constant 'NULL' passed into function parse_number, argument str,
from call at line 876.
Null pointer introduced at line 98 in function 'copy_to_scratch'.
[ This bug was found by the Parfait 1.4.0 bug checking tool.
http://labs.oracle.com/pls/apex/f?p=labs:49:::::P49_PROJECT_ID:13 ]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'handle.c')
-rw-r--r-- | handle.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -873,6 +873,9 @@ do_pointer(char *line, int len) return; } strval = copy_to_scratch(line, n); + if (strval == NULL) + /* copy_to_scratch already printed error message */ + return; ok = parse_number (strval, &val); if (!ok || val >= MAXBUTTONCODES) { badmsg ("value %s given for buttons list", strval); |