stas            Wed Sep 19 00:38:48 2007 UTC

  Modified files:              
    /php-src/ext/xmlrpc/libxmlrpc       encodings.c 
  Log:
  MFB: limit iconv parameters here too
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/xmlrpc/libxmlrpc/encodings.c?r1=1.7&r2=1.8&diff_format=u
Index: php-src/ext/xmlrpc/libxmlrpc/encodings.c
diff -u php-src/ext/xmlrpc/libxmlrpc/encodings.c:1.7 
php-src/ext/xmlrpc/libxmlrpc/encodings.c:1.8
--- php-src/ext/xmlrpc/libxmlrpc/encodings.c:1.7        Mon Mar  8 23:04:33 2004
+++ php-src/ext/xmlrpc/libxmlrpc/encodings.c    Wed Sep 19 00:38:48 2007
@@ -41,7 +41,7 @@
 #include <stdlib.h>
 #endif
 
-static const char rcsid[] = "#(@) $Id: encodings.c,v 1.7 2004/03/08 23:04:33 
abies Exp $";
+static const char rcsid[] = "#(@) $Id: encodings.c,v 1.8 2007/09/19 00:38:48 
stas Exp $";
 
 #include <errno.h>
 
@@ -53,6 +53,10 @@
 
 #include "encodings.h"
 
+#ifndef ICONV_CSNMAXLEN
+#define ICONV_CSNMAXLEN 64
+#endif
+
 static char* convert(const char* src, int src_len, int *new_len, const char* 
from_enc, const char* to_enc) {
    char* outbuf = 0;
 
@@ -60,9 +64,13 @@
       size_t outlenleft = src_len;
       size_t inlenleft = src_len;
       int outlen = src_len;
-      iconv_t ic = iconv_open(to_enc, from_enc);
+      iconv_t ic;
       char* out_ptr = 0;
 
+      if(strlen(to_enc) >= ICONV_CSNMAXLEN || strlen(from_enc) >= 
ICONV_CSNMAXLEN) {
+         return NULL;
+      }
+      ic = iconv_open(to_enc, from_enc);
       if(ic != (iconv_t)-1) {
          size_t st;
          outbuf = (char*)malloc(outlen + 1);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to