diff --git a/lib/libfetch/fetch.c b/lib/libfetch/fetch.c index 9eec0730fa7d..82a3c5e451a9 100644 --- a/lib/libfetch/fetch.c +++ b/lib/libfetch/fetch.c @@ -327,6 +327,9 @@ fetch_pctdecode(char *dst, const char *src, size_t dlen) (d2 = fetch_hexval(s[2])) >= 0 && (d1 > 0 || d2 > 0)) { c = d1 << 4 | d2; s += 2; + } else if (s[0] == '%') { + /* Invalid escape sequence. */ + return (NULL); } else { c = *s; }