Browse Source

[core] configparser: error on duplicate keys in array merge (fixes #2685)

From: Glenn Strauss <gstrauss@gluelogic.com>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3103 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/heads/lighttpd-1.4.x
Glenn Strauss 6 years ago
committed by Stefan Bühler
parent
commit
43da581893
  1. 1
      NEWS
  2. 8
      src/configparser.y

1
NEWS

@ -31,6 +31,7 @@ NEWS
* [core] refactor array search; raise array size limit to SSIZE_MAX
* [core] fix memory leak in configparser_merge_data
* [core] provide array_extract_element and use it
* [core] configparser: error on duplicate keys in array merge (fixes #2685)
- 1.4.39 - 2016-01-02
* [core] fix memset_s call (fixes #2698)

8
src/configparser.y

@ -92,7 +92,13 @@ data_unset *configparser_merge_data(data_unset *op1, const data_unset *op2) {
for (i = 0; i < src->used; i ++) {
du = (data_unset *)src->data[i];
if (du) {
array_insert_unique(dst, du->copy(du));
if (du->is_index_key || buffer_is_empty(du->key) || !array_get_element(dst, du->key->ptr)) {
array_insert_unique(dst, du->copy(du));
} else {
fprintf(stderr, "Duplicate array-key '%s'\n", du->key->ptr);
op1->free(op1);
return NULL;
}
}
}
break;

Loading…
Cancel
Save