diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2008-11-13 18:21:54 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2008-11-13 18:21:54 +0000 |
| commit | c037b6175f7c397fec97fa23830b69c6bea45bec (patch) | |
| tree | 831f248b570e35f71abccdeb5eec89e3e4542f92 | |
| parent | ed247d6d41947f7d082cbeaf62f2a4c479c96c6d (diff) | |
| download | php-git-c037b6175f7c397fec97fa23830b69c6bea45bec.tar.gz | |
MFB: Fixed a bug inside dba_replace() that could cause file truncation with
invalid keys
| -rw-r--r-- | ext/dba/libinifile/inifile.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/dba/libinifile/inifile.c b/ext/dba/libinifile/inifile.c index 22f8063f6f..9a81dd09a1 100644 --- a/ext/dba/libinifile/inifile.c +++ b/ext/dba/libinifile/inifile.c @@ -507,7 +507,9 @@ static int inifile_delete_replace_append(inifile *dba, const key_type *key, cons /* 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))) { + ret = inifile_truncate(dba, append ? pos_grp_next : pos_grp_start TSRMLS_CC); /* writes error on fail */ + } } if (ret == SUCCESS) { |
