You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by mt...@apache.org on 2007/02/08 19:17:33 UTC

svn commit: r504988 - /jakarta/commons/proper/daemon/trunk/src/native/nt/procrun/src/utils.c

Author: mturk
Date: Thu Feb  8 10:17:32 2007
New Revision: 504988

URL: http://svn.apache.org/viewvc?view=rev&rev=504988
Log:
Fix overrun bug. Thanks to Rohit S. Singh for spotting the bug, although I made a fix different from his patch.

Modified:
    jakarta/commons/proper/daemon/trunk/src/native/nt/procrun/src/utils.c

Modified: jakarta/commons/proper/daemon/trunk/src/native/nt/procrun/src/utils.c
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/daemon/trunk/src/native/nt/procrun/src/utils.c?view=diff&rev=504988&r1=504987&r2=504988
==============================================================================
--- jakarta/commons/proper/daemon/trunk/src/native/nt/procrun/src/utils.c (original)
+++ jakarta/commons/proper/daemon/trunk/src/native/nt/procrun/src/utils.c Thu Feb  8 10:17:32 2007
@@ -850,16 +850,17 @@
 
     l = __apxGetMultiSzLengthW(szStr, &c);    
     b = rv = apxPoolCalloc(hPool, (l + c + 2) * sizeof(WCHAR));
-    do {
+
+    while (c > 0) {
         if (*p)
             *b++ = *p;
         else {
             *b++ = L'\r';
             *b++ = L'\n';
+            c--;
         }
         p++;
-    } while( *p || *(p + 1));
- 
+    }
     return rv;
 }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org