summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2024-01-12 20:40:31 -0600
committerDudemanguy <random342@airmail.cc>2024-01-12 20:46:00 -0600
commit2dd3951a9c05e7a4fc0a614f13de1bfe0e7f132f (patch)
treedef017de89ede79cd5edc49294081b4183cf246a
parente15b2b19a3548c8c210d86a77b52d495494a1e20 (diff)
downloadmpv-2dd3951a9c05e7a4fc0a614f13de1bfe0e7f132f.tar.bz2
mpv-2dd3951a9c05e7a4fc0a614f13de1bfe0e7f132f.tar.xz
filter_sdh: fix incorrect placement of null terminator
The +1 here is not correct. For a 4-byte unicode character, this would throw a runtime error because the +1 would try to assign the null terminator past the actual bound of our array. Just remove it since it should be exactly equal to whatever we have for bytes.
-rw-r--r--sub/filter_sdh.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sub/filter_sdh.c b/sub/filter_sdh.c
index 0a1d36749e..a4b1aeb097 100644
--- a/sub/filter_sdh.c
+++ b/sub/filter_sdh.c
@@ -389,7 +389,7 @@ static char *filter_SDH(struct sd_filter *sd, char *data, int length, ptrdiff_t
int bytes = get_char_bytes(rp);
for (int i = 0; i < bytes; i++)
left[i] = rp[i];
- left[bytes + 1] = '\0';
+ left[bytes] = '\0';
right = get_right_enclosure(left);
}
if (left[0] && right && right[0]) {