Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-gnome
Path: blob/main/archivers/arc/files/patch-arcio.c
16149 views
1
--- arcio.c.orig 2010-08-07 13:06:42 UTC
2
+++ arcio.c
3
@@ -46,7 +46,7 @@ readhdr(hdr, f) /* read a header from
4
return 0; /* then signal end of archive */
5
6
if (hdrver != ARCMARK) { /* check archive validity */
7
- if (warn) {
8
+ if (arcwarn) {
9
printf("An entry in %s has a bad header.\n", arcname);
10
nerrs++;
11
}
12
@@ -67,10 +67,10 @@ readhdr(hdr, f) /* read a header from
13
if (feof(f) && first)
14
arcdie("%s is not an archive", arcname);
15
16
- if (changing && warn)
17
+ if (changing && arcwarn)
18
arcdie("%s is corrupted -- changes disallowed", arcname);
19
20
- if (warn)
21
+ if (arcwarn)
22
printf(" %d bytes skipped.\n", try);
23
24
if (feof(f))
25
@@ -118,7 +118,8 @@ readhdr(hdr, f) /* read a header from
26
hdr->crc = (short) ((dummy[22] << 8) + dummy[21]);
27
for (i = 0, hdr->length=0; i<4; hdr->length<<=8, hdr->length += dummy[26-i], i++);
28
#endif
29
-
30
+ if (hdr->size < 0)
31
+ arcdie("Invalid header in archive %s", arcname);
32
if (hdr->date > olddate
33
|| (hdr->date == olddate && hdr->time > oldtime)) {
34
olddate = hdr->date;
35
36