Skip to content

Commit

Permalink
BUG/MINOR: pattern: do not leave a leading comma on "set" error messages
Browse files Browse the repository at this point in the history
Commit 4f2493f ("BUG/MINOR: pattern: pat_ref_set: fix UAF reported by
coverity") dropped the condition to concatenate error messages and as
such introduced a leading comma in front of all of them. Then commit
911f4d9 ("BUG/MINOR: pattern: pat_ref_set: return 0 if err was found")
changed the behavior to stop at the first error anyway, so all the
mechanics dedicated to the concatenation of error messages is no longer
needed and we can simply return the error as-is, without inserting any
comma.

This should be backported where the patches above are backported.

(cherry picked from commit 9f8d9c9)
Signed-off-by: Willy Tarreau <[email protected]>
(cherry picked from commit 6cae9b3)
Signed-off-by: Willy Tarreau <[email protected]>
  • Loading branch information
wtarreau committed Sep 10, 2024
1 parent 1557823 commit ac9756e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pattern.c
Original file line number Diff line number Diff line change
Expand Up @@ -1793,8 +1793,10 @@ int pat_ref_set(struct pat_ref *ref, const char *key, const char *value, char **
elt = ebmb_entry(node, struct pat_ref_elt, node);
node = ebmb_next_dup(node);
if (!pat_ref_set_elt(ref, elt, value, &tmp_err)) {
memprintf(err, "%s, %s", err && *err ? *err : "", tmp_err);
ha_free(&tmp_err);
if (err)
*err = tmp_err;
else
ha_free(&tmp_err);
return 0;
}
found = 1;
Expand Down

0 comments on commit ac9756e

Please sign in to comment.