summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hex.c3
1 files changed, 3 insertions, 0 deletions
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 ];