Re: cvs: php-src(PHP_5_3) /ext/dba/libinifile inifile.c
| From: | Ilia Alshanetsky | Date: | Thu, 13 Nov 2008 21:44:29 +0000 |
| Subject: | Re: cvs: php-src(PHP_5_3) /ext/dba/libinifile inifile.c | ||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-54255@lists.php.net to get a copy of this message | ||
Just to stay consistent with the existing code used in that file.
On 13-Nov-08, at 2:35 PM, Marcus Boerger wrote:
Hello Ilia, Thursday, November 13, 2008, 7:21:40 PM, you wrote:Ilia Alshanetskyiliaa Thu Nov 13 18:21:40 2008 UTCWhy strlen here? Doing (key->name && *key->name) would be enough.Modified files: (Branch: PHP_5_3) /php-src/ext/dba/libinifile inifile.cLog: Fixed a bug inside dba_replace() that could cause file truncation with invalid keys http://cvs.php.net/viewvc.cgi/php-src/ext/dba/libinifile/inifile.c?r1=1.14.2.1.2.3.2.1&r2=1.14.2.1.2.3.2.2&diff_format=u Index: php-src/ext/dba/libinifile/inifile.c diff -u php-src/ext/dba/libinifile/inifile.c:1.14.2.1.2.3.2.1 php-src/ext/dba/libinifile/inifile.c:1.14.2.1.2.3.2.2--- php-src/ext/dba/libinifile/inifile.c:1.14.2.1.2.3.2.1 Mon Dec 31 07:17:07 2007 +++ php-src/ext/dba/libinifile/inifile.c Thu Nov 13 18:21:40 2008@@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: inifile.c,v 1.14.2.1.2.3.2.1 2007/12/31 07:17:07 sebastian Exp $ */ +/* $Id: inifile.c,v 1.14.2.1.2.3.2.2 2008/11/13 18:21:40 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -43,7 +43,7 @@ /* {{{ inifile_version */ char *inifile_version() {- return "1.0, $Revision: 1.14.2.1.2.3.2.1 $"; + return "1.0, $Revision: 1.14.2.1.2.3.2.2 $";} /* }}} */ @@ -508,7 +508,9 @@/* 5 */ if (ret == SUCCESS) { - ret = inifile_truncate(dba, append ? pos_grp_next :pos_grp_start TSRMLS_CC); /* writes error on fail */+ if (!value || (key->name && strlen(key->name))) {Best regards, Marcus+ ret = inifile_truncate(dba, append ?pos_grp_next : pos_grp_start TSRMLS_CC); /* writes error on fail */+ } }if (ret == SUCCESS) {