shithub: riscv

Download patch

ref: 0d701b77592a7364529b300cbaad938326be1710
parent: 20b8f1e777d04ce7daa771ee75092192d3120bda
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri May 15 03:53:22 EDT 2015

gunzip: the extra length field (XLEN) is two bytes instead of one

example file:
https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R50f.tgz

--- a/sys/src/cmd/gzip/gunzip.c
+++ b/sys/src/cmd/gzip/gunzip.c
@@ -236,9 +236,12 @@
 	/* OS type */
 	get1(bin);
 
-	if(flag & GZFEXTRA)
-		for(i=get1(bin); i>0; i--)
+	if(flag & GZFEXTRA){
+		i = get1(bin);
+		i |= get1(bin)<<8;
+		for(; i>0; i--)
 			get1(bin);
+	}
 
 	/* name */
 	if(flag & GZFNAME){