diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-06-29 21:20:31 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-06-29 21:20:31 +0000 |
commit | 28fb10f422f4625c8f96902291781134ce7480f6 (patch) | |
tree | 11ddea8daeef82d4ccf8ceebfba6339ac000d85a | |
parent | 4d3ce3168697232f8d3fae53c2c45bd3aae0f64f (diff) | |
download | mandoc-28fb10f422f4625c8f96902291781134ce7480f6.tar.gz |
Bugfix in roff_setstrn():
Do not call strcmp() on an array of char that might not be NUL-terminated.
-rw-r--r-- | roff.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -2068,7 +2068,8 @@ roff_setstrn(struct roffkv **r, const char *name, size_t namesz, /* Search for an existing string with the same name. */ n = *r; - while (n && strcmp(name, n->key.p)) + while (n && (namesz != n->key.sz || + strncmp(n->key.p, name, namesz))) n = n->next; if (NULL == n) { |