From b5757d41a9428ebe5b100bb8269e231b1993fb24 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Fri, 5 Jun 2020 23:46:21 +0200 Subject: [PATCH] :art: Limit length for did_you_mean --- src/parse/did_you_mean.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/parse/did_you_mean.c b/src/parse/did_you_mean.c index a9ae6956..29ed8100 100644 --- a/src/parse/did_you_mean.c +++ b/src/parse/did_you_mean.c @@ -43,8 +43,12 @@ ANN static void ressembles(const Vector v, const Nspc nspc, const char* name) { } } +#define MAX_NAME_LEN 16 +#define CHECK_LEN(name) if(strlen(name) > MAX_NAME_LEN) return; + #undef did_you_mean_nspc ANN void did_you_mean_nspc(Nspc nspc, const char* name) { + CHECK_LEN(name) struct Vector_ v; vector_init(&v); do ressembles(&v, nspc, name); @@ -56,6 +60,7 @@ ANN void did_you_mean_nspc(Nspc nspc, const char* name) { #undef did_you_mean_type ANN void did_you_mean_type(Type type, const char* name) { + CHECK_LEN(name) Type t = type; struct Vector_ v; vector_init(&v); -- 2.43.0