# --- T2-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # T2 SDE: package/.../screen/correct_va_list.patch # Copyright (C) 2004 - 2006 The T2 SDE Project # Copyright (C) 1998 - 2003 ROCK Linux Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- T2-COPYRIGHT-NOTE-END --- On some architectures that either store the variable args as an array of pointers (of length 1) or they are passed in registers (see man va_arg) the macro va_copy is needed .... - Rene Rebe <rene@exactcode.de> --- ./screen.c.orig 2003-02-24 18:03:47.000000000 +0100 +++ ./screen.c 2003-08-26 01:19:42.000000000 +0200 @@ -377,7 +377,7 @@ #ifdef DEBUG opendebug(1, 0); #endif - sprintf(version, "%d.%.2d.%.2d%s (%s) %s", REV, VERS, + snprintf(version, 40, "%d.%.2d.%.2d%s (%s) %s", REV, VERS, PATCHLEVEL, STATE, ORIGIN, DATE); nversion = REV * 10000 + VERS * 100 + PATCHLEVEL; debug2("-- screen debug started %s (%s)\n", *av, version); @@ -1943,13 +1943,16 @@ VA_DECL #endif { - VA_LIST(ap) + VA_LIST(ap); + VA_LIST(aq); char buf[MAXPATHLEN*2]; char *p = buf; VA_START(ap, fmt); + va_copy (aq, ap); fmt = DoNLS(fmt); - (void)vsnprintf(p, sizeof(buf) - 100, fmt, VA_ARGS(ap)); + (void)vsnprintf(p, sizeof(buf) - 100, fmt, aq); + VA_END(aq); VA_END(ap); if (err) { --- ./screen.c 2003-11-14 19:51:27.000000000 +0100 +++ ./screen.c 2003-11-14 19:49:16.000000000 +0100 @@ -1890,12 +1890,15 @@ #endif { VA_LIST(ap) + VA_LIST(aq) char buf[MAXPATHLEN*2]; char *p = buf; VA_START(ap, fmt); fmt = DoNLS(fmt); - (void)vsnprintf(p, sizeof(buf) - 100, fmt, VA_ARGS(ap)); + va_copy (aq, ap); + (void)vsnprintf(p, sizeof(buf) - 100, fmt, aq); + VA_END(aq); VA_END(ap); if (err) {