From e4107acb3961e60f0fa34591e25276735bdba610 Mon Sep 17 00:00:00 2001 From: Chris Kuethe Date: Sat, 14 Apr 2007 05:49:48 +0000 Subject: shift blame... passing in a NULL gets you a NULL back. calling functions should be more careful --- hex.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'hex.c') diff --git a/hex.c b/hex.c index c29d63b7..cc22da79 100644 --- a/hex.c +++ b/hex.c @@ -17,6 +17,9 @@ char /*@ observer @*/ *gpsd_hexdump(const void *binbuf, size_t binbuflen) const char *ibuf = (const char *)binbuf; const char *hexchar = "0123456789abcdef"; + if (NULL == binbuf) + return NULL; + /*@ -shiftimplementation @*/ for (i = 0; i < len; i++) { hexbuf[j++] = hexchar[ (ibuf[i]&0xf0)>>4 ]; -- cgit v1.2.1