Skip to content

Commit

Permalink
Fix reading a memory right after the end of an allocated area.
Browse files Browse the repository at this point in the history
The problem evinced itself when somebody tried to use the macro
expansion on the string "%!". The problem was revealed by compiling
with "--fsanitize=memory" (rhbz:#1260248).
  • Loading branch information
lkardos committed Sep 21, 2015
1 parent f0a58d1 commit 54f24ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rpmio/macro.c
Expand Up @@ -993,7 +993,7 @@ expandMacro(MacroBuf mb, const char *src, size_t slen)
chkexist = 0;
switch ((c = *s)) {
default: /* %name substitution */
while (strchr("!?", *s) != NULL) {
while (*s != '\0' && strchr("!?", *s) != NULL) {
switch(*s++) {
case '!':
negate = ((negate + 1) % 2);
Expand Down

0 comments on commit 54f24ec

Please sign in to comment.