popt/popt-libc-updates.patch
Dirk Mueller 65681cb03d Accepting request 817934 from home:gmbr3:Active
- Update to version 1.18:
* fix an ugly and ancient security issue with popt failing to drop privileges on alias exec from a SUID/SGID program
* perform rudimentary sanity checks when reading in popt config files
* collect accumulated misc fixes (memleaks etc) from distros
* convert translations to utf-8 encoding
* convert old postscript documentation to pdf
* dust off ten years worth of autotools sediment
* reorganize and clean up the source tree for clarity
* remove the obnoxious splint annotations from the sources
- popt-alignment-checks.patch removed: contained in upstream
- popt-libc-updates.patch changed: to be compatible with new version.

OBS-URL: https://build.opensuse.org/request/show/817934
OBS-URL: https://build.opensuse.org/package/show/Base:System/popt?expand=0&rev=54
2020-08-15 23:52:30 +00:00

89 lines
2.5 KiB
Diff

Index: configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,6 @@
AM_INIT_AUTOMAKE([1.10 foreign -Wall])
AC_PROG_CC_STDC
-AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
AM_PROG_AR
Index: src/system.h
===================================================================
--- a/src/system.h
+++ b/src/system.h
@@ -2,9 +2,7 @@
* \file popt/system.h
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
#include <ctype.h>
@@ -57,6 +55,8 @@
#define getenv(_s) secure_getenv(_s)
#elif defined(HAVE___SECURE_GETENV)
#define getenv(_s) __secure_getenv(_s)
+#else
+#error neither secure_getenv nor __secure_getenv is available
#endif
#if !defined(__GNUC__) && !defined(__attribute__)
Index: src/popt.c
===================================================================
--- a/src/popt.c
+++ b/src/popt.c
@@ -197,7 +197,7 @@ poptContext poptGetContext(const char *
con->execAbsolute = 1;
con->arg_strip = NULL;
- if (getenv("POSIXLY_CORRECT") || getenv("POSIX_ME_HARDER"))
+ if (secure_getenv("POSIXLY_CORRECT") || secure_getenv("POSIX_ME_HARDER"))
con->flags |= POPT_CONTEXT_POSIXMEHARDER;
if (name)
@@ -442,7 +442,7 @@ const char * findProgramPath(/*@null@*/
if (strchr(argv0, '/'))
return xstrdup(argv0);
- if ((path = getenv("PATH")) == NULL || (path = xstrdup(path)) == NULL)
+ if ((path = secure_getenv("PATH")) == NULL || (path = xstrdup(path)) == NULL)
return NULL;
/* The return buffer in t is big enough for any path. */
@@ -1706,6 +1706,7 @@ const char * poptBadOption(poptContext c
const char * poptStrerror(const int error)
{
+ char errbuf[1024];
switch (error) {
case POPT_ERROR_NOARG:
return POPT_("missing argument");
@@ -1728,7 +1729,7 @@ const char * poptStrerror(const int erro
case POPT_ERROR_BADCONFIG:
return POPT_("config file failed sanity test");
case POPT_ERROR_ERRNO:
- return strerror(errno);
+ return strerror_r(errno, errbuf, sizeof errbuf);
default:
return POPT_("unknown error");
}
Index: src/poptconfig.c
===================================================================
--- a/src/poptconfig.c
+++ b/src/poptconfig.c
@@ -540,7 +540,7 @@ int poptReadDefaultConfig(poptContext co
if (rc) goto exit;
#endif
- if ((home = getenv("HOME"))) {
+ if ((home = secure_getenv("HOME"))) {
char * fn = malloc(strlen(home) + 20);
if (fn != NULL) {
(void) stpcpy(stpcpy(fn, home), "/.popt");