mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
gnu: unzip: Add patches from Fedora [security fixes].
Non-exhaustively fixes CVE-2016-9844, CVE-2018-1000035, CVE-2018-18384, and CVE-2019-13232. * gnu/packages/patches/unzip-COVSCAN-fix-unterminated-string.patch, gnu/packages/patches/unzip-CVE-2016-9844.patch, gnu/packages/patches/unzip-CVE-2018-1000035.patch, gnu/packages/patches/unzip-CVE-2018-18384.patch, gnu/packages/patches/unzip-case-insensitive.patch, gnu/packages/patches/unzip-alt-iconv-utf8-print.patch, gnu/packages/patches/unzip-alt-iconv-utf8.patch, gnu/packages/patches/unzip-close.patch, gnu/packages/patches/unzip-exec-shield.patch, gnu/packages/patches/unzip-fix-recmatch.patch, gnu/packages/patches/unzip-manpage-fix.patch, gnu/packages/patches/unzip-overflow.patch, gnu/packages/patches/unzip-symlink.patch, gnu/packages/patches/unzip-timestamp.patch, gnu/packages/patches/unzip-valgrind.patch, gnu/packages/patches/unzip-x-option.patch, gnu/packages/patches/unzip-zipbomb-manpage.patch, gnu/packages/patches/unzip-zipbomb-part1.patch, gnu/packages/patches/unzip-zipbomb-part2.patch, gnu/packages/patches/unzip-zipbomb-part3.patch: New patches. * gnu/local.mk (dist_patch_DATA): Register them. * gnu/packages/compression.scm (unzip/fixed): New variable. Apply patches. (unzip)[replacement]: Graft.
This commit is contained in:
parent
92d0949a26
commit
31d289a475
22 changed files with 2540 additions and 0 deletions
131
gnu/packages/patches/unzip-caseinsensitive.patch
Normal file
131
gnu/packages/patches/unzip-caseinsensitive.patch
Normal file
|
@ -0,0 +1,131 @@
|
|||
diff --git a/match.c b/match.c
|
||||
index 6cd656f..4e569f5 100644
|
||||
--- a/match.c
|
||||
+++ b/match.c
|
||||
@@ -190,10 +190,10 @@ char *___tmp_ptr;
|
||||
|
||||
#endif
|
||||
|
||||
-static int recmatch(p, s, cs)
|
||||
+static int recmatch(p, s, ci)
|
||||
ZCONST char *p; /* sh pattern to match */
|
||||
ZCONST char *s; /* string to match it to */
|
||||
-int cs; /* flag: force case-sensitive matching */
|
||||
+int ci; /* flag: force case-insensitive matching */
|
||||
/* Recursively compare the sh pattern p with the string s and return 1 if
|
||||
they match, and 0 or 2 if they don't or if there is a syntax error in the
|
||||
pattern. This routine recurses on itself no deeper than the number of
|
||||
@@ -214,7 +214,7 @@ int cs; /* flag: force case-sensitive matching */
|
||||
if (CLEN(p) == 2) {
|
||||
if (CLEN(s) == 2) {
|
||||
return (*p == *s && *(p+1) == *(s+1)) ?
|
||||
- recmatch(p + 2, s + 2, cs) : 0;
|
||||
+ recmatch(p + 2, s + 2, ci) : 0;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@@ -230,9 +230,9 @@ int cs; /* flag: force case-sensitive matching */
|
||||
/* '?' (or '%' or '#') matches any character (but not an empty string) */
|
||||
if (c == WILDCHR_SINGLE) {
|
||||
if (wild_stop_at_dir)
|
||||
- return (*s && *s != DIRSEP_CHR) ? recmatch(p, s + CLEN(s), cs) : 0;
|
||||
+ return (*s && *s != DIRSEP_CHR) ? recmatch(p, s + CLEN(s), ci) : 0;
|
||||
else
|
||||
- return *s ? recmatch(p, s + CLEN(s), cs) : 0;
|
||||
+ return *s ? recmatch(p, s + CLEN(s), ci) : 0;
|
||||
}
|
||||
|
||||
/* WILDCHR_MULTI ('*') matches any number of characters, including zero */
|
||||
@@ -253,14 +253,14 @@ int cs; /* flag: force case-sensitive matching */
|
||||
# endif /* ?AMIGA */
|
||||
/* Single WILDCHR_MULTI ('*'): this doesn't match slashes */
|
||||
for (; *s && *s != DIRSEP_CHR; INCSTR(s))
|
||||
- if ((c = recmatch(p, s, cs)) != 0)
|
||||
+ if ((c = recmatch(p, s, ci)) != 0)
|
||||
return c;
|
||||
/* end of pattern: matched if at end of string, else continue */
|
||||
if (*p == 0)
|
||||
return (*s == 0);
|
||||
/* continue to match if at DIRSEP_CHR in pattern, else give up */
|
||||
return (*p == DIRSEP_CHR || (*p == '\\' && p[1] == DIRSEP_CHR))
|
||||
- ? recmatch(p, s, cs) : 2;
|
||||
+ ? recmatch(p, s, ci) : 2;
|
||||
}
|
||||
/* Two consecutive WILDCHR_MULTI ("**"): this matches DIRSEP_CHR ('/') */
|
||||
p++; /* move p past the second WILDCHR_MULTI */
|
||||
@@ -308,17 +308,17 @@ int cs; /* flag: force case-sensitive matching */
|
||||
*/
|
||||
if (q != srest)
|
||||
return 0;
|
||||
- return ((cs ? strcmp(p, q) : namecmp(p, q)) == 0);
|
||||
+ return ((!ci ? strcmp(p, q) : namecmp(p, q)) == 0);
|
||||
}
|
||||
#else /* !_MBCS */
|
||||
- return ((cs ? strcmp(p, srest) : namecmp(p, srest)) == 0);
|
||||
+ return ((!ci ? strcmp(p, srest) : namecmp(p, srest)) == 0);
|
||||
#endif /* ?_MBCS */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* pattern contains more wildcards, continue with recursion... */
|
||||
for (; *s; INCSTR(s))
|
||||
- if ((c = recmatch(p, s, cs)) != 0)
|
||||
+ if ((c = recmatch(p, s, ci)) != 0)
|
||||
return c;
|
||||
return 2; /* 2 means give up--shmatch will return false */
|
||||
}
|
||||
@@ -353,17 +353,17 @@ int cs; /* flag: force case-sensitive matching */
|
||||
c = *(p-1);
|
||||
else
|
||||
{
|
||||
- uch cc = (cs ? (uch)*s : case_map((uch)*s));
|
||||
+ uch cc = (!ci ? (uch)*s : to_up((uch)*s));
|
||||
uch uc = (uch) c;
|
||||
if (*(p+1) != '-')
|
||||
for (uc = uc ? uc : (uch)*p; uc <= (uch)*p; uc++)
|
||||
/* compare range */
|
||||
- if ((cs ? uc : case_map(uc)) == cc)
|
||||
- return r ? 0 : recmatch(q + CLEN(q), s + CLEN(s), cs);
|
||||
+ if ((!ci ? uc : to_up(uc)) == cc)
|
||||
+ return r ? 0 : recmatch(q + CLEN(q), s + CLEN(s), ci);
|
||||
c = e = 0; /* clear range, escape flags */
|
||||
}
|
||||
}
|
||||
- return r ? recmatch(q + CLEN(q), s + CLEN(s), cs) : 0;
|
||||
+ return r ? recmatch(q + CLEN(q), s + CLEN(s), ci) : 0;
|
||||
/* bracket match failed */
|
||||
}
|
||||
#endif /* !VMS */
|
||||
@@ -382,18 +382,18 @@ int cs; /* flag: force case-sensitive matching */
|
||||
{
|
||||
/* Match "...]" with "]". Continue after "]" in both. */
|
||||
if ((*(p+ 2* CLEN( p)) == ']') && (*s == ']'))
|
||||
- return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), cs);
|
||||
+ return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), ci);
|
||||
|
||||
/* Else, look for a reduced match in s, until "]" in or end of s. */
|
||||
for (; *s && (*s != ']'); INCSTR(s))
|
||||
if (*s == '.')
|
||||
/* If reduced match, then continue after "..." in p, "." in s. */
|
||||
- if ((c = recmatch( (p+ CLEN( p)), s, cs)) != 0)
|
||||
+ if ((c = recmatch( (p+ CLEN( p)), s, ci)) != 0)
|
||||
return (int)c;
|
||||
|
||||
/* Match "...]" with "]". Continue after "]" in both. */
|
||||
if ((*(p+ 2* CLEN( p)) == ']') && (*s == ']'))
|
||||
- return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), cs);
|
||||
+ return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), ci);
|
||||
|
||||
/* No reduced match. Quit. */
|
||||
return 2;
|
||||
@@ -402,8 +402,8 @@ int cs; /* flag: force case-sensitive matching */
|
||||
#endif /* def VMS */
|
||||
|
||||
/* Just a character--compare it */
|
||||
- return (cs ? c == *s : case_map((uch)c) == case_map((uch)*s)) ?
|
||||
- recmatch(p, s + CLEN(s), cs) : 0;
|
||||
+ return (!ci ? c == *s : to_up((uch)c) == to_up((uch)*s)) ?
|
||||
+ recmatch(p, s + CLEN(s), ci) : 0;
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue