[CVS] RPM: popt/ poptint.c

2010-08-09 Thread Jeff Johnson
  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

2008-03-09 Thread Jeff Johnson
  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

2007-06-14 Thread Ralf S. Engelschall
  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 stdio.h
   #include stdarg.h
   #include errno.h
  +#ifdef HAVE_ICONV
   #include iconv.h
  +#endif
   #ifdef HAVE_LANGINFO_H
   #include langinfo.h
   #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