]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
Fix segfault: v.printf() cannot be called twice on the same arg list
authoryobibe <yobibe@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Fri, 5 Jun 2009 09:24:51 +0000 (09:24 +0000)
committeryobibe <yobibe@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Fri, 5 Jun 2009 09:24:51 +0000 (09:24 +0000)
See man.
By chance it worked on 32-bit platforms but on a 64-bit it crashed.

linux/gui.c

index 2179a5ece819cc9bac131a67f46800a67bb4fb97..e8751a6287977dd784e5e47ed545520836aa055f 100644 (file)
@@ -15,7 +15,7 @@ int offline;
 static char *logfilename = "proxmark3.log";
 
 void PrintToScrollback(char *fmt, ...) {
-       va_list argptr;
+       va_list argptr, argptr2;
        static FILE *logfile = NULL;
        static int logging=1;
 
@@ -28,7 +28,9 @@ void PrintToScrollback(char *fmt, ...) {
        }
 
        va_start(argptr, fmt);
+       va_copy(argptr2, argptr);
        vprintf(fmt, argptr);
+       va_end(argptr);
        printf("\n");
        if (logging && logfile) {
 #if 0
@@ -42,11 +44,11 @@ void PrintToScrollback(char *fmt, ...) {
 
                fprintf(logfile,"%s ", zeit);
 #endif
-               vfprintf(logfile, fmt, argptr);
+               vfprintf(logfile, fmt, argptr2);
                fprintf(logfile,"\n");
                fflush(logfile);
        }
-       va_end(argptr);
+       va_end(argptr2);
 }
 
 void setlogfilename(char *fn)
Impressum, Datenschutz