unzip/unzip-5.52-CVE-2005-4667.patch

42 lines
1.5 KiB
Diff

--- unzip-5.52.orig/unzpriv.h
+++ unzip-5.52/unzpriv.h
@@ -783,6 +783,7 @@
# define TIMET_TO_NATIVE(x)
# define NATIVE_TO_TIMET(x)
#endif
+ /*
#ifndef SSTAT
# ifdef WILD_STAT_BUG
# define SSTAT(path,pbuf) (iswild(path) || stat(path,pbuf))
@@ -790,6 +791,8 @@
# define SSTAT stat
# endif
#endif
+ */
+# define SSTAT stat
#ifndef STRNICMP
# ifdef NO_STRNICMP
# define STRNICMP zstrnicmp
@@ -2271,17 +2274,18 @@
* (char *)(sprintf sprf_arg, (buf))) == EOF)
*/
#ifndef Info /* may already have been defined for redirection */
+# define wsizesnprintf(buf, ...) snprintf (buf, WSIZE-1, __VA_ARGS__)
# ifdef FUNZIP
# define Info(buf,flag,sprf_arg) \
- fprintf((flag)&1? stderr : stdout, (char *)(sprintf sprf_arg, (buf)))
+ fputs((char *)(wsizesnprintf sprf_arg, (buf)), (flag)&1? stderr : stdout)
# else
# ifdef INT_SPRINTF /* optimized version for "int sprintf()" flavour */
# define Info(buf,flag,sprf_arg) \
- (*G.message)((zvoid *)&G, (uch *)(buf), (ulg)sprintf sprf_arg, (flag))
+ (*G.message)((zvoid *)&G, (uch *)(buf), (ulg)wsizesnprintf sprf_arg, (flag))
# else /* generic version, does not use sprintf() return value */
# define Info(buf,flag,sprf_arg) \
(*G.message)((zvoid *)&G, (uch *)(buf), \
- (ulg)(sprintf sprf_arg, strlen((char *)(buf))), (flag))
+ (ulg)(wsizesnprintf sprf_arg, strlen((char *)(buf))), (flag))
# endif
# endif
#endif /* !Info */