This defect was found by the coccinelle script "unchecked-strdup.cocci".
It can be backported to all supported branches.
---
src/listener.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/listener.c b/src/listener.c
index 5f3a98b4a..5fb610a88 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -2369,8 +2369,11 @@ static int bind_parse_name(char **args, int cur_arg,
struct proxy *px, struct bi
return ERR_ALERT | ERR_FATAL;
}
- list_for_each_entry(l, &conf->listeners, by_bind)
+ list_for_each_entry(l, &conf->listeners, by_bind) {
l->name = strdup(args[cur_arg + 1]);
+ if (!l->name)
+ return ERR_ALERT | ERR_FATAL;
+ }
return 0;
}
--
2.46.0.windows.1