diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2011-04-28 00:51:30 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2011-04-28 00:51:30 -0700 |
commit | 90640776b88b32cea2316670a3b29f7785aadc7a (patch) | |
tree | fd7dd37a170ed30fb2d0d4e52e295e562a244a6c | |
parent | ada8df395e72f84127394dadd15a180afa8ec0ec (diff) |
Error out and avoid a call to malloc(0) if given a bad hex string
Found-by: clang static analyzer
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r-- | process.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -401,8 +401,8 @@ static int cvthexkey ( /* turn hex key string into octets */ len++; } - /* if odd then there was an error */ - if ((len & 1) == 1) return -1; + /* if 0 or odd, then there was an error */ + if (len == 0 || (len & 1) == 1) return -1; /* now we know that the input is good */ |