aports/main/pgpool/fix-snprintf.patch
Andy Postnikov b9fc0ae0e0 main/pgpool: security upgrade to 4.5.4 - CVE-2024-45624
added patches to build on 32-bits
2024-10-27 16:02:46 +01:00

41 lines
941 B
Diff

--- a/src/parser/snprintf.c
+++ b/src/parser/snprintf.c
@@ -403,17 +404,6 @@
* Note: glibc declares this as returning "char *", but that would require
* casting away const internally, so we don't follow that detail.
*/
-#ifndef HAVE_STRCHRNUL
-
-static inline const char *
-strchrnul(const char *s, int c)
-{
- while (*s != '\0' && *s != c)
- s++;
- return s;
-}
-
-#else
/*
* glibc's <string.h> declares strchrnul only if _GNU_SOURCE is defined.
@@ -425,7 +415,6 @@
extern char *strchrnul(const char *s, int c);
#endif
-#endif /* HAVE_STRCHRNUL */
/*
@@ -767,9 +756,10 @@
break;
case 'm':
{
- char errbuf[PG_STRERROR_R_BUFLEN];
- const char *errm = strerror_r(save_errno,
+ char errbuf[256];
+ int ret = strerror_r(save_errno,
errbuf, sizeof(errbuf));
+ const char *errm = (ret == 0) ? errbuf : "Unknown error";
dostr(errm, strlen(errm), target);
}