diff --git src/base16.c src/base16.c
index 889f77d..8001cd5 100644
--- src/base16.c
+++ src/base16.c
@@ -42,7 +42,7 @@ base16_encode(char *src)
len = (strlen(src) * 2);
- dst = malloc(len);
+ dst = malloc(len + 1);
if (!dst) {
return NULL;
diff --git src/conf.c src/conf.c
index 3433d7f..05301a1 100644
--- src/conf.c
+++ src/conf.c
@@ -245,7 +245,8 @@ parse_cfgfile(CONF this)
optionptr = option = xstrdup(line);
while (*optionptr && !ISSPACE((int)*optionptr) && !ISSEPARATOR(*optionptr))
optionptr++;
- *optionptr++=0;
+ if (*optionptr) // are we already at the end?
+ *optionptr++=0;
while (ISSPACE((int)*optionptr) || ISSEPARATOR(*optionptr))
optionptr++;
value = xstrdup(optionptr);