From 66140fa90056db9b16dc90883b3602d5e95fcbdc Mon Sep 17 00:00:00 2001 From: Raheman Vaiya Date: Sat, 19 Aug 2023 12:08:44 -0400 Subject: [PATCH] Issue maximum name length warning --- src/config.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/config.c b/src/config.c index cd97c46..2129db0 100644 --- a/src/config.c +++ b/src/config.c @@ -369,6 +369,11 @@ static int config_add_layer(struct config *config, const char *s) char buf[MAX_LAYER_NAME_LEN]; char *name; + if (strlen(s) >= sizeof buf) { + err("%s exceeds maximum section length(%d) (ignoring)", s, MAX_LAYER_NAME_LEN); + return -1; + } + strcpy(buf, s); name = strtok(buf, ":");