hholzgra                Mon Feb 24 08:35:06 2003 EDT

  Modified files:              
    /php4/ext/yp        yp.c 
  Log:
  "key" has to be zero-delimited 
  
  
Index: php4/ext/yp/yp.c
diff -u php4/ext/yp/yp.c:1.34 php4/ext/yp/yp.c:1.35
--- php4/ext/yp/yp.c:1.34       Fri Jan 24 11:34:18 2003
+++ php4/ext/yp/yp.c    Mon Feb 24 08:35:06 2003
@@ -16,7 +16,7 @@
    |          Fredrik Ohrn                                                |
    +----------------------------------------------------------------------+
  */
-/* $Id: yp.c,v 1.34 2003/01/24 16:34:18 iliaa Exp $ */
+/* $Id: yp.c,v 1.35 2003/02/24 13:35:06 hholzgra Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -295,8 +295,17 @@
 
        if (!err)
        {
-               if (inkeylen)
-                       add_assoc_stringl_ex((zval *) 
indata,inkey,inkeylen,inval,invallen,1);
+               if (inkeylen) {
+                       char *key = malloc(inkeylen+1);
+                       if(key) {
+                               strncpy(key, inkey, inkeylen);
+                               key[inkeylen] = '\0';
+                               add_assoc_stringl_ex((zval *) indata, key, inkeylen+1, 
inval, invallen, 1);
+                               free(key);
+                       } else {
+                               php_error(E_WARNING, "Can't allocate %d bytes for key 
buffer in yp_cat()");
+                       }
+               }
 
                return 0;
        }



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

Reply via email to