]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DEV: coccinelle: Fix incorrect replacement in ist.cocci
authorTim Duesterhus <tim@bastelstu.be>
Tue, 15 Mar 2022 12:11:05 +0000 (13:11 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 21 Mar 2022 07:30:47 +0000 (08:30 +0100)
We must not use `ist2()` if the value of `i.len` is derived from the value of
`i.ptr`:

    i.ptr = "foo";
    i.len = strlen(i.ptr);

dev/coccinelle/ist.cocci

index 4945141b25b617dffb5ce7b3c6a69d922ac9de0f..ea13d39d25f7c622422fc70c846d9830892bad59 100644 (file)
@@ -3,9 +3,14 @@ struct ist i;
 expression p, l;
 @@
 
+(
+ i.ptr = p;
+ i.len = strlen(i.ptr);
+|
 - i.ptr = p;
 - i.len = l;
 + i = ist2(p, l);
+)
 
 @@
 @@