]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: sample: exit regsub() in case of trash allocation error
authorWilly Tarreau <w@1wt.eu>
Tue, 18 Feb 2020 13:27:44 +0000 (14:27 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 18 Feb 2020 13:27:44 +0000 (14:27 +0100)
As reported in issue #507, since commiy 07e1e3c93e ("MINOR: sample:
regsub now supports backreferences") we must not proceed in regsub()
if we fali to allocate a trash (which in practice never happens). No
backport needed.

src/sample.c

index 24d21100e08b3cb1c9c73fba764096ef0b102085..d3568708df346431a05cc16dff66048e91923a56 100644 (file)
@@ -2388,6 +2388,9 @@ static int sample_conv_regsub(const struct arg *arg_p, struct sample *smp, void
                        break;
 
                output = alloc_trash_chunk();
+               if (!output)
+                       break;
+
                output->data = exp_replace(output->area, output->size, start, arg_p[1].data.str.area, pmatch);
 
                /* replace the matching part */