From 90640776b88b32cea2316670a3b29f7785aadc7a Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Thu, 28 Apr 2011 00:51:30 -0700 Subject: 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 --- process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/process.c b/process.c index f51e643..56b7aaf 100644 --- a/process.c +++ b/process.c @@ -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 */ -- cgit v1.2.1