summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dpmcgee@gmail.com>2009-05-03 19:55:32 -0500
committerDan McGee <dpmcgee@gmail.com>2009-05-03 19:55:32 -0500
commit41266b5d6c45c059a77f61e4c6b00ba330252136 (patch)
tree1002c355a9dc0309a19c82e3da8d313bf3a18aad
parent786d7ba82208d1befba9764efeee73a31982a194 (diff)
downloadonkyocontrol-41266b5d6c45c059a77f61e4c6b00ba330252136.tar.gz
onkyocontrol-41266b5d6c45c059a77f61e4c6b00ba330252136.zip
hash_sdbm: return 0 if passed NULL
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
-rw-r--r--util.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/util.c b/util.c
index d2ffc28..8ae295c 100644
--- a/util.c
+++ b/util.c
@@ -79,6 +79,8 @@ ssize_t xwrite(int fd, const void *buf, size_t len)
unsigned long hash_sdbm(const char *str)
{
unsigned long hash = 0;
+ if(!str)
+ return hash;
int c;
while((c = *str++))
hash = c + (hash << 6) + (hash << 16) - hash;