Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 321439 | Differences between
and this patch

Collapse All | Expand All

(-)a/rpmoffset.c (+17 lines)
Lines 25-30 typedef struct { Link Here
25
	const size_t len;
25
	const size_t len;
26
} magic_t;
26
} magic_t;
27
27
28
int is_lzma_header(char *buf) {
29
	return (buf[0] < 0xE1
30
		&& buf[0] == 0x5d
31
		&& buf[4] < 0x20
32
		&& (memcmp (buf + 10 , "\x00\x00\x00", 3) == 0
33
		    || (memcmp (buf + 5, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", 8) == 0)));
34
}
35
28
static const unsigned char magic_gzip[]  = { '\037', '\213', '\010' };
36
static const unsigned char magic_gzip[]  = { '\037', '\213', '\010' };
29
static const unsigned char magic_bzip2[] = { 'B', 'Z', 'h' };
37
static const unsigned char magic_bzip2[] = { 'B', 'Z', 'h' };
30
static const unsigned char magic_xz[]    = { 0xFD, '7', 'z', 'X', 'Z', 0x00 };
38
static const unsigned char magic_xz[]    = { 0xFD, '7', 'z', 'X', 'Z', 0x00 };
Lines 76-81 int main(int argc, char *argv[]) Link Here
76
				return 0;
84
				return 0;
77
			}
85
			}
78
		}
86
		}
87
        
88
        for (i = 0; i < read_cnt; i++) {
89
            if (read_cnt + left > 10 && is_lzma_header(p+i)) {
90
		    	if (show_magic)
91
		    		printf("lzma ");
92
		    	printf("%zu\n", offset+i);
93
		    	return 0;
94
		    }
95
        }
79
96
80
		memmove(p, p + left + read_cnt - MAGIC_SIZE_MIN + 1, MAGIC_SIZE_MIN - 1);
97
		memmove(p, p + left + read_cnt - MAGIC_SIZE_MIN + 1, MAGIC_SIZE_MIN - 1);
81
98

Return to bug 321439