=================================================================== RCS file: /cvs/mandoc/mandocdb.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -p -r1.50 -r1.51 --- mandoc/mandocdb.c 2012/06/08 10:43:01 1.50 +++ mandoc/mandocdb.c 2012/06/08 12:05:27 1.51 @@ -1,4 +1,4 @@ -/* $Id: mandocdb.c,v 1.50 2012/06/08 10:43:01 kristaps Exp $ */ +/* $Id: mandocdb.c,v 1.51 2012/06/08 12:05:27 kristaps Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011, 2012 Ingo Schwarze @@ -79,7 +79,7 @@ struct str { const struct of *of; /* if set, the owning parse */ struct str *next; /* next in owning parse sequence */ uint64_t mask; /* bitmask in sequence */ - char key[1]; /* the string itself */ + char key[]; /* the string itself */ }; struct id { @@ -1538,7 +1538,7 @@ straddbuf(const char *cp, size_t sz) if (NULL != (s = hashget(cp, sz))) return(s->key); - s = mandoc_calloc(sizeof(struct str) + sz, 1); + s = mandoc_calloc(sizeof(struct str) + sz + 1, 1); memcpy(s->key, cp, sz); end = cp + sz; @@ -1585,7 +1585,7 @@ wordaddbuf(const struct of *of, s->mask |= v; return; } else if (NULL == s) { - s = mandoc_calloc(sizeof(struct str) + sz, 1); + s = mandoc_calloc(sizeof(struct str) + sz + 1, 1); memcpy(s->key, cp, sz); end = cp + sz; index = ohash_qlookupi(&strings, cp, &end);