diff options
author | nicm <nicm> | 2023-07-03 10:48:26 +0000 |
---|---|---|
committer | nicm <nicm> | 2023-07-03 10:48:26 +0000 |
commit | ac43186dff0f4e92a566987bb9108d6c5421e9ff (patch) | |
tree | 985a596b43b1cd806d2ff14f4d181b3e7028371f | |
parent | e79fb214f8001c309c9ae11eba5fcbbac97f1acf (diff) |
Do not risk writing over the end of the buffer when it ends in #
(because strchr \0 will be non-NULL), reported by Robert Morris in
GitHub issue 3610.
-rw-r--r-- | format.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -3664,7 +3664,9 @@ format_skip(const char *s, const char *end) for (; *s != '\0'; s++) { if (*s == '#' && s[1] == '{') brackets++; - if (*s == '#' && strchr(",#{}:", s[1]) != NULL) { + if (*s == '#' && + s[1] != '\0' && + strchr(",#{}:", s[1]) != NULL) { s++; continue; } |