From c0838068e374d5931a61240217dd320226675c8e Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Mon, 2 Aug 2010 09:10:35 +0000 Subject: [PATCH] Fix a logf bug which would trigger undefined behaviour(and probably crash) when both DEBUG, CONFIG_PLATFORM & PLATFORM_HOSTED are enable git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27663 a1c6a512-1295-4272-9138-f99709370657 --- firmware/logf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/firmware/logf.c b/firmware/logf.c index 0136600e92..d8f036703e 100644 --- a/firmware/logf.c +++ b/firmware/logf.c @@ -212,6 +212,9 @@ void _logf(const char *fmt, ...) char buf[1024]; vsnprintf(buf, sizeof buf, fmt, ap); DEBUGF("%s\n", buf); + /* restart va_list otherwise the result if undefined when vuprintf is called */ + va_end(ap); + va_start(ap, fmt); #endif vuprintf(logf_push, NULL, fmt, ap);