shithub: libtags

Download patch

ref: a64636173e0d162d0e9e36d40fad32d1bc56898b
parent: 19f590de69c3f287c128ecd6e58e4ebf9a24a24f
author: jacqueline <me@jacqueline.id.au>
date: Sun Jul 30 22:28:45 EDT 2023

Don't null-terminate already null-terminated strings

This was causing issues with genre tags sourced from id3genres (I think
all m4a files with genres might be affected?). id3genres is const, so
even when the write is a no-op, attempting it caused a segfault

--- a/tags.c
+++ b/tags.c
@@ -46,7 +46,8 @@
 		e = s + strlen(s);
 		while(e != s && (uchar)e[-1] <= ' ')
 			e--;
-		*e = 0;
+		if(*e != 0)
+		  *e = 0;
 	}
 	if(*s){
 		ctx->tag(ctx, type, k, s, offset, size, f);