cvs: php4 /ext/yp yp.c
| From: | Hartmut Holzgraefe | Date: | Mon, 24 Feb 2003 13:35:06 +0000 |
| Subject: | cvs: php4 /ext/yp yp.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-19128@lists.php.net to get a copy of this message | ||
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;
}