ref: a225c927060b13c9e37ac7ad60d7470d062d2075
parent: c39ecb52df1ca8981880a0b82bfd471805983739
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Feb 19 13:07:04 EST 2024
wav: respect buffer size when reading tag value
--- a/wav.c
+++ b/wav.c
@@ -67,13 +67,13 @@
}else if(memcmp(d, "LIST", 4) == 0){
sz = csz - 4;
continue;
- }else if(info){
+ }else if(info && csz < ctx->bufsz){
for(n = 0; n < nelem(t); n++){
if(memcmp(d, t[n].s, 4) == 0 || t[n].type == Tunknown){
if(ctx->read(ctx, d+5, csz) != (int)csz)
return -1;
d[4] = 0;
- d[5+csz-1] = 0;
+ d[5+csz] = 0;
txtcb(ctx, t[n].type, t[n].type == Tunknown ? (char*)d : "", d+5);
csz = 0;
break;