1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-29 00:27:11 +00:00

Reduce buffer size by 1 to keep space for the '\0' added after the loop.

Fixes CID 492348
OK tb@
This commit is contained in:
claudio
2025-11-04 18:48:41 +00:00
parent 9db21cf2a4
commit 9ce49ce628

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: qs.c,v 1.7 2024/12/03 10:38:06 claudio Exp $ */
/* $OpenBSD: qs.c,v 1.8 2025/11/04 18:48:41 claudio Exp $ */
/*
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
*
@@ -81,7 +81,7 @@ urldecode(const char *s, size_t len)
size_t i, blen = 0;
for (i = 0; i < len; i++) {
if (blen >= sizeof(buf))
if (blen >= sizeof(buf) - 1)
return NULL;
if (s[i] == '+') {
buf[blen++] = ' ';