trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sji...@apache.org
Subject svn commit: r930487 - in /incubator/trafficserver/traffic/branches/2.0.x: STATUS libinktomi++/ink_sprintf.cc
Date Sat, 03 Apr 2010 07:24:39 GMT
Author: sjiang
Date: Sat Apr  3 07:24:39 2010
New Revision: 930487

URL: http://svn.apache.org/viewvc?rev=930487&view=rev
Log:
TS-268: ink_bvsprintf should do a va_copy to be idempotent 

Merged from trunk

Modified:
    incubator/trafficserver/traffic/branches/2.0.x/STATUS
    incubator/trafficserver/traffic/branches/2.0.x/libinktomi++/ink_sprintf.cc

Modified: incubator/trafficserver/traffic/branches/2.0.x/STATUS
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/2.0.x/STATUS?rev=930487&r1=930486&r2=930487&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/2.0.x/STATUS (original)
+++ incubator/trafficserver/traffic/branches/2.0.x/STATUS Sat Apr  3 07:24:39 2010
@@ -84,6 +84,13 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
     Jira: https://issues.apache.org/jira/browse/TS-260
     +1: sjiang, zwoop, georgep
  
+  * core: ink_bvsprintf isn't idempotent on its va_list, causing a
+    crash when invoked multiple times on the same va_list. This occurs
+    in the body factory.
+    Trunk patch: http://svn.apache.org/viewvc?rev=926431&view=rev
+    Jira: https://issues.apache.org/jira/browse/TS-268
+    +1: sjiang, zwoop, georgep
+
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
@@ -99,13 +106,6 @@ PATCHES PROPOSED TO BACKPORT FROM TRUNK:
     Jira: https://issues.apache.org/jira/browse/TS-162
     +1: bcall
 
-  * core: ink_bvsprintf isn't idempotent on its va_list, causing a 
-    crash when invoked multiple times on the same va_list. This occurs
-    in the body factory.
-    Trunk patch: http://svn.apache.org/viewvc?rev=926431&view=rev
-    Jira: https://issues.apache.org/jira/browse/TS-268
-    +1: sjiang, zwoop, georgep
-
   * API: ts.h does not compile ANSI C due to bool in 
     INKHttpTxnSetHttpRetBody prototype
     Trunk patch: http://svn.apache.org/viewcvs?view=rev&rev=929862

Modified: incubator/trafficserver/traffic/branches/2.0.x/libinktomi++/ink_sprintf.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/2.0.x/libinktomi%2B%2B/ink_sprintf.cc?rev=930487&r1=930486&r2=930487&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/2.0.x/libinktomi++/ink_sprintf.cc (original)
+++ incubator/trafficserver/traffic/branches/2.0.x/libinktomi++/ink_sprintf.cc Sat Apr  3
07:24:39 2010
@@ -69,6 +69,8 @@ ink_bvsprintf(char *buffer, char *format
 {
   int d_val;
   char *s, *d, *p, *s_val, d_buffer[32];
+  va_list ap_local;
+  va_copy(ap_local, ap);
 
   s = format;
   d = buffer;
@@ -105,7 +107,7 @@ ink_bvsprintf(char *buffer, char *format
     {
     case 's':                  // %s pattern
       ++s;                      // consume 's'
-      s_val = va_arg(ap, char *);       // grab string argument
+      s_val = va_arg(ap_local, char *);       // grab string argument
       p = s_val;                // temporary pointer
       if (buffer)               // if have output buffer
         while (*p) {
@@ -119,7 +121,7 @@ ink_bvsprintf(char *buffer, char *format
       break;
     case 'd':                  // %d pattern
       ++s;                      // consume 'd'
-      d_val = va_arg(ap, int);  // grab integer argument
+      d_val = va_arg(ap_local, int);  // grab integer argument
       snprintf(d_buffer, sizeof(d_buffer), "%d", d_val);        // stringify integer
       p = d_buffer;             // temporary pointer
       if (buffer)               // if have output buffer
@@ -145,5 +147,6 @@ ink_bvsprintf(char *buffer, char *format
     *d = NUL;
   ++d;
 
+  va_end(ap_local);
   return (int) (d - buffer);
 }



Mime
View raw message