From 06b8fe94ef8e07dde1ff7cc33d9d940448fb1109 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Tue, 8 May 2012 11:23:56 +0200 Subject: Renamed the function cString::sprintf(const char *fmt, va_list &ap) to vsprintf() --- CONTRIBUTORS | 3 +++ HISTORY | 3 +++ svdrp.c | 4 ++-- thread.c | 4 ++-- tools.c | 4 ++-- tools.h | 4 ++-- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 324b37ab..346c3863 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2593,6 +2593,9 @@ Sundararaj Reel for reporting a memory leak in cRecordings::ScanVideoDir() in case there are too many link levels for reporting a bug in cListBase::Move() in case From and To are equal + for reporting a problem with the function cString::sprintf(const char *fmt, va_list &ap), + that might inadvertently be called with a 'char *' as the second argument on some + compilers and cause a crash Ales Jurik for reporting broken SI data on Czech/Slovak channels after changing the default diff --git a/HISTORY b/HISTORY index 6800e091..0f2a23cd 100644 --- a/HISTORY +++ b/HISTORY @@ -7096,3 +7096,6 @@ Video Disk Recorder Revision History - Fixed a possible high CPU load when pausing replay (thanks to Reinhard Nissl). - Fixed character comparisons in cSubtitleObject::DecodeCharacterString() (reported by Reinhard Mantey). +- Renamed the function cString::sprintf(const char *fmt, va_list &ap) to vsprintf(), + because it might inadvertently be called with a 'char *' as the second argument on + some compilers and cause a crash (reported by Sundararaj Reel). diff --git a/svdrp.c b/svdrp.c index 7884ec58..b762cf14 100644 --- a/svdrp.c +++ b/svdrp.c @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * graphical interface that sits on top of an SVDRP connection. * - * $Id: svdrp.c 2.17 2012/04/26 10:36:11 kls Exp $ + * $Id: svdrp.c 2.18 2012/05/08 11:23:56 kls Exp $ */ #include "svdrp.h" @@ -432,7 +432,7 @@ void cSVDRP::Reply(int Code, const char *fmt, ...) if (Code != 0) { va_list ap; va_start(ap, fmt); - cString buffer = cString::sprintf(fmt, ap); + cString buffer = cString::vsprintf(fmt, ap); va_end(ap); const char *s = buffer; while (s && *s) { diff --git a/thread.c b/thread.c index e6a88980..5bcc9a54 100644 --- a/thread.c +++ b/thread.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: thread.c 2.3 2009/04/13 13:50:39 kls Exp $ + * $Id: thread.c 2.4 2012/05/08 11:15:57 kls Exp $ */ #include "thread.h" @@ -239,7 +239,7 @@ void cThread::SetDescription(const char *Description, ...) if (Description) { va_list ap; va_start(ap, Description); - description = strdup(cString::sprintf(Description, ap)); + description = strdup(cString::vsprintf(Description, ap)); va_end(ap); } } diff --git a/tools.c b/tools.c index 3296b540..0f3ab0a9 100644 --- a/tools.c +++ b/tools.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 2.22 2012/02/18 15:30:35 kls Exp $ + * $Id: tools.c 2.23 2012/05/08 11:13:13 kls Exp $ */ #include "tools.h" @@ -958,7 +958,7 @@ cString cString::sprintf(const char *fmt, ...) return cString(buffer, true); } -cString cString::sprintf(const char *fmt, va_list &ap) +cString cString::vsprintf(const char *fmt, va_list &ap) { char *buffer; if (!fmt || vasprintf(&buffer, fmt, ap) < 0) { diff --git a/tools.h b/tools.h index 2cba42cf..ad54c879 100644 --- a/tools.h +++ b/tools.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.h 2.17 2012/04/01 11:36:10 kls Exp $ + * $Id: tools.h 2.18 2012/05/08 11:11:33 kls Exp $ */ #ifndef __TOOLS_H @@ -177,7 +177,7 @@ public: cString &operator=(const char *String); cString &Truncate(int Index); ///< Truncate the string at the given Index (if Index is < 0 it is counted from the end of the string). static cString sprintf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); - static cString sprintf(const char *fmt, va_list &ap); + static cString vsprintf(const char *fmt, va_list &ap); }; ssize_t safe_read(int filedes, void *buffer, size_t size); -- cgit v1.2.3