[vlc-commits] json: correct buffer size
Rémi Denis-Courmont
git at videolan.org
Sun Sep 27 20:23:35 CEST 2020
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Sep 27 21:22:03 2020 +0300| [8d75253af434f6874b2bcaad7dab12e3e46d0af7] | committer: Rémi Denis-Courmont
json: correct buffer size
We don't need a trailing nul in this particular case.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8d75253af434f6874b2bcaad7dab12e3e46d0af7
---
modules/demux/json/json.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/demux/json/json.c b/modules/demux/json/json.c
index 602ffb6897..d928be3f71 100644
--- a/modules/demux/json/json.c
+++ b/modules/demux/json/json.c
@@ -42,7 +42,7 @@ char *json_unescape(const char *in, size_t inlen)
/* 1) Convert UTF-8 to UTF-16.
* This will catch any invalid UTF-8 byte sequence.
*/
- size_t buflen = 2 * (inlen + 1);
+ size_t buflen = 2 * inlen;
void *buf = malloc(buflen);
if (unlikely(buf == NULL))
More information about the vlc-commits
mailing list