[CVS] RPM: popt/ poptint.c
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: popt Date: 09-Aug-2010 19:31:45 Branch: HEAD Handle: 2010080917314500 Modified files: poptpoptint.c Log: - fix: obscure iconv mis-call error path could lead to strdup(NULL) (coverity). Summary: RevisionChanges Path 1.28+1 -1 popt/poptint.c patch -p0 <<'@@ .' Index: popt/poptint.c $ cvs diff -u -r1.27 -r1.28 poptint.c --- popt/poptint.c18 Jun 2010 02:03:29 - 1.27 +++ popt/poptint.c9 Aug 2010 17:31:45 - 1.28 @@ -145,7 +145,7 @@ } (void) iconv_close(cd); *pout = '\0'; - ostr = xstrdup(dstr); + ostr = xstrdup(dstr ? dstr : istr); free(dstr); } else ostr = xstrdup(istr); @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: popt/ poptint.c
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: popt Date: 10-Mar-2008 05:06:23 Branch: HEAD Handle: 2008031004062300 Modified files: poptpoptint.c Log: - jbj: fix: typ, vasprintf needs an ampersand. Thanks Wayne! Summary: RevisionChanges Path 1.19+1 -1 popt/poptint.c patch -p0 <<'@@ .' Index: popt/poptint.c $ cvs diff -u -r1.18 -r1.19 poptint.c --- popt/poptint.c9 Mar 2008 22:53:24 - 1.18 +++ popt/poptint.c10 Mar 2008 04:06:23 - 1.19 @@ -159,7 +159,7 @@ #if defined(HAVE_VASPRINTF) va_start(ap, format); -if ((rc = vasprintf(b, format, ap)) < 0) +if ((rc = vasprintf(&b, format, ap)) < 0) b = NULL; va_end(ap); #else @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: popt/ poptint.c
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Ralf S. Engelschall Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: popt Date: 15-Jun-2007 15:50:12 Branch: HEAD Handle: 2007061514501200 Modified files: poptpoptint.c Log: a single va_end is sufficient Summary: RevisionChanges Path 1.8 +0 -1 popt/poptint.c patch -p0 <<'@@ .' Index: popt/poptint.c $ cvs diff -u -r1.7 -r1.8 poptint.c --- popt/poptint.c15 Jun 2007 12:49:56 - 1.7 +++ popt/poptint.c15 Jun 2007 13:50:12 - 1.8 @@ -103,7 +103,6 @@ buffer = calloc (sizeof (char), vsnprintf (&c, 1, format, ap) + 1); vsprintf (buffer, format, apc); - va_end(apc); va_end(apc); @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: popt/ poptint.c poptint.h
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: popt Date: 15-Jun-2007 14:49:56 Branch: HEAD Handle: 2007061513495600 Modified files: poptpoptint.c poptint.h Log: match va_copy with a va_end. remove the GNOMEish warning. Summary: RevisionChanges Path 1.7 +1 -1 popt/poptint.c 1.25+0 -2 popt/poptint.h patch -p0 <<'@@ .' Index: popt/poptint.c $ cvs diff -u -r1.6 -r1.7 poptint.c --- popt/poptint.c15 Jun 2007 12:47:37 - 1.6 +++ popt/poptint.c15 Jun 2007 12:49:56 - 1.7 @@ -103,6 +103,7 @@ buffer = calloc (sizeof (char), vsnprintf (&c, 1, format, ap) + 1); vsprintf (buffer, format, apc); + va_end(apc); va_end(apc); @@ -141,7 +142,6 @@ retval = fprintf (stream, "%s", locale_str); free (locale_str); } else { -fprintf (stderr, POPT_WARNING "%s\n", "Invalid UTF-8"); #endif retval = fprintf (stream, "%s", buffer); #ifdef HAVE_ICONV @@ . patch -p0 <<'@@ .' Index: popt/poptint.h $ cvs diff -u -r1.24 -r1.25 poptint.h --- popt/poptint.h25 May 2007 17:36:23 - 1.24 +++ popt/poptint.h15 Jun 2007 12:49:56 - 1.25 @@ -114,8 +114,6 @@ #define N_(foo) foo -#define POPT_WARNING "(popt): Warning **: " - int POPT_fprintf (FILE* steam, const char *format, ...); char *POPT_prev_char (const char *str); @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: popt/ poptint.c
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Arkadiusz Miskiewicz Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: popt Date: 15-Jun-2007 14:47:37 Branch: HEAD Handle: 2007061513473700 Modified files: poptpoptint.c Log: va_end on copy. Summary: RevisionChanges Path 1.6 +2 -0 popt/poptint.c patch -p0 <<'@@ .' Index: popt/poptint.c $ cvs diff -u -r1.5 -r1.6 poptint.c --- popt/poptint.c15 Jun 2007 12:41:14 - 1.5 +++ popt/poptint.c15 Jun 2007 12:47:37 - 1.6 @@ -104,6 +104,8 @@ buffer = calloc (sizeof (char), vsnprintf (&c, 1, format, ap) + 1); vsprintf (buffer, format, apc); + va_end(apc); + return buffer; } @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: popt/ poptint.c
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: popt Date: 15-Jun-2007 14:41:14 Branch: HEAD Handle: 2007061513411400 Modified files: poptpoptint.c Log: linux amd64/ppc cannot reuse a va_list. make a copy instead. Summary: RevisionChanges Path 1.5 +4 -1 popt/poptint.c patch -p0 <<'@@ .' Index: popt/poptint.c $ cvs diff -u -r1.4 -r1.5 poptint.c --- popt/poptint.c14 Jun 2007 07:54:52 - 1.4 +++ popt/poptint.c15 Jun 2007 12:41:14 - 1.5 @@ -97,9 +97,12 @@ { char *buffer = NULL; char c; + va_list apc; + + va_copy(apc, ap); /* XXX linux amd64/ppc needs a copy. */ buffer = calloc (sizeof (char), vsnprintf (&c, 1, format, ap) + 1); - vsprintf (buffer, format, ap); + vsprintf (buffer, format, apc); return buffer; } @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: popt/ poptint.c
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Ralf S. Engelschall Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: popt Date: 14-Jun-2007 09:54:52 Branch: HEAD Handle: 2007061408545200 Modified files: poptpoptint.c Log: declare iconv(3) related variable under HAVE_ICONV only Summary: RevisionChanges Path 1.4 +2 -0 popt/poptint.c patch -p0 <<'@@ .' Index: popt/poptint.c $ cvs diff -u -r1.3 -r1.4 poptint.c --- popt/poptint.c14 Jun 2007 07:21:45 - 1.3 +++ popt/poptint.c14 Jun 2007 07:54:52 - 1.4 @@ -122,7 +122,9 @@ int retval = 0; va_list args; char *buffer = NULL; +#ifdef HAVE_ICONV char *locale_str = NULL; +#endif va_start (args, format); buffer = strdup_vprintf (format, args); @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: popt/ poptint.c
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Ralf S. Engelschall Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: popt Date: 14-Jun-2007 09:21:46 Branch: HEAD Handle: 2007061408214500 Modified files: poptpoptint.c Log: Fix iconv(3) usage. POPT assumed that iconv(3) is available all the time. This is not the case. It _might_ be available (and then indicated by the #define HAVE_ICONV from gettext) if NLS is enabled. But if NLS is disabled (--disable-nls) then the gettext NLS stuff not even _checks_ for an available iconv(3) and hence it cannot even be used with an explicit --with-libiconv-prefix, etc. Hence we POPT can use iconv(3) only for its UTF-8 fiddling if HAVE_ICONV is defined. Summary: RevisionChanges Path 1.3 +8 -0 popt/poptint.c patch -p0 <<'@@ .' Index: popt/poptint.c $ cvs diff -u -r1.2 -r1.3 poptint.c --- popt/poptint.c25 May 2007 18:34:14 - 1.2 +++ popt/poptint.c14 Jun 2007 07:21:45 - 1.3 @@ -5,7 +5,9 @@ #include #include #include +#ifdef HAVE_ICONV #include +#endif #ifdef HAVE_LANGINFO_H #include #endif @@ -18,6 +20,7 @@ (retval) = vfprintf ((stream), (format), (args)); \ va_end ((args)); +#ifdef HAVE_ICONV static char * strdup_locale_from_utf8 (char *buffer) { @@ -87,6 +90,7 @@ return dest_str; } +#endif static char * strdup_vprintf (const char *format, va_list ap) @@ -124,14 +128,18 @@ buffer = strdup_vprintf (format, args); va_end (args); +#ifdef HAVE_ICONV locale_str = strdup_locale_from_utf8 (buffer); if (locale_str) { retval = fprintf (stream, "%s", locale_str); free (locale_str); } else { fprintf (stderr, POPT_WARNING "%s\n", "Invalid UTF-8"); +#endif retval = fprintf (stream, "%s", buffer); +#ifdef HAVE_ICONV } +#endif free (buffer); return retval; @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org