From: Jérémie Astor Date: Fri, 5 Jun 2020 21:46:21 +0000 (+0200) Subject: :art: Limit length for did_you_mean X-Git-Tag: nightly~1488 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=b5757d41a9428ebe5b100bb8269e231b1993fb24;p=gwion.git :art: Limit length for did_you_mean --- 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);