]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: WURFL: segfault in wurfl-get() with missing info.
authormbellomi <massimiliano@scientiamobile.com>
Tue, 21 May 2019 13:32:48 +0000 (15:32 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 22 May 2019 10:06:02 +0000 (12:06 +0200)
A segfault may happen in ha_wurfl_get() when dereferencing information not
present in wurfl-information-list. Check the node retrieved from the tree,
not its container.

This fix must be backported to 1.9.

src/wurfl.c

index 325cba6496a84f02ea4cfdd871e5af2b432530f4..7167a929f8ff9f81f58856843d763a5229af2fd4 100644 (file)
@@ -514,9 +514,10 @@ static int ha_wurfl_get(const struct arg *args, struct sample *smp, const char *
        while (args[i].data.str.area) {
                chunk_appendf(temp, "%c", global_wurfl.information_list_separator);
                node = ebst_lookup(&global_wurfl.btree, args[i].data.str.area);
-               wn = container_of(node, wurfl_data_t, nd);
 
-               if (wn) {
+               if (node) {
+
+                       wn = container_of(node, wurfl_data_t, nd);
 
                        switch(wn->type) {
                        case HA_WURFL_DATA_TYPE_UNKNOWN :