diff options
| author | Hartmut Holzgraefe <hholzgra@php.net> | 2003-02-24 13:35:07 +0000 |
|---|---|---|
| committer | Hartmut Holzgraefe <hholzgra@php.net> | 2003-02-24 13:35:07 +0000 |
| commit | cfb377ce3302250e23a5f039f2580fddb1649fe7 (patch) | |
| tree | 4003658036ccdc13b3be2bf76726be2f41cffa04 /ext/yp | |
| parent | 535aa63293341a662ba534d17cc17bd7c00d56e4 (diff) | |
| download | php-git-cfb377ce3302250e23a5f039f2580fddb1649fe7.tar.gz | |
"key" has to be zero-delimited
Diffstat (limited to 'ext/yp')
| -rw-r--r-- | ext/yp/yp.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/yp/yp.c b/ext/yp/yp.c index 7fda2f0e04..8706ccffb2 100644 --- a/ext/yp/yp.c +++ b/ext/yp/yp.c @@ -295,8 +295,17 @@ static int php_foreach_cat (int instatus, char *inkey, int inkeylen, char *inval 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; } |
