author | Olivier Brunel
<jjk@jjacky.com> 2023-04-18 08:09:17 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2023-04-18 08:09:17 UTC |
parent | a275c8ce14daeffd913c1ada74d5eba8d2e6174a |
src/ssp/ssp.c | +4 | -0 |
diff --git a/src/ssp/ssp.c b/src/ssp/ssp.c index be77bbd..6c3f7e3 100644 --- a/src/ssp/ssp.c +++ b/src/ssp/ssp.c @@ -4,6 +4,7 @@ #include <errno.h> #include <locale.h> #include <skalibs/env.h> +#include <limb/bytestr.h> #include <limb/command.h> #include <limb/esc.h> #include <limb/exitcode.h> @@ -52,6 +53,9 @@ get_site_name(const char *s, struct ssp *ctx) l = esc_scan(ctx->sa.s + ctx->sa.len, l, s + 1, l); if (l < 0) return NULL; + /* make sure there was no encoded NUL byte */ + if (byte_chr(ctx->sa.s + ctx->sa.len, l, 0) < l) + return (errno = EINVAL, NULL); ctx->sa.s[l++] = 0; ctx->sa.len += l; return ctx->sa.s + salen;