SHA256
3
0
forked from pool/rpm
rpm/safemacro.diff

22 lines
623 B
Diff

--- rpmio/macro.c.orig 2011-05-17 08:43:40.000000000 +0000
+++ rpmio/macro.c 2011-05-17 08:44:48.000000000 +0000
@@ -1016,12 +1016,12 @@ expandMacro(MacroBuf mb, const char *src
char *source = NULL;
/* Handle non-terminated substrings by creating a terminated copy */
- if (slen > 0) {
- source = xmalloc(slen + 1);
- strncpy(source, src, slen);
- source[slen] = '\0';
- s = source;
- }
+ if (!slen)
+ slen = strlen(src);
+ source = xmalloc(slen + 1);
+ strncpy(source, src, slen);
+ source[slen] = '\0';
+ s = source;
if (mb->buf == NULL) {
size_t blen = MACROBUFSIZ + strlen(s);