Browse Source

Fix warnings

master
JustAnotherArchivist 11 months ago
parent
commit
427884af5e
2 changed files with 5 additions and 4 deletions
  1. +4
    -3
      http-response-bodies.c
  2. +1
    -1
      warc-dump-responses.c

+ 4
- 3
http-response-bodies.c View File

@@ -91,6 +91,7 @@ checkstate:
}
// Handle optional URL + Length line
url = NULL;
urllen = 0;
if (memcmp(bufp, "HTTP/1.1 ", 9) != 0 && memcmp(bufp, "HTTP/1.0 ", 9) != 0) {
DEBUG_PRINTF("No HTTP header, looking for URL line\n");
m0 = memmem(bufp, n, "\n", 1);
@@ -120,7 +121,7 @@ checkstate:
return 1;
}
DEBUG_PRINTF("Found URL: ");
for (int i = 0; i < (urllen > 64 ? 64 : urllen); ++i) DEBUG_PRINTF(isprint(*(url + i)) ? "%c" : "\\x%02x", *(url + i) & 0xFF);
for (unsigned int i = 0; i < (urllen > 64 ? 64 : urllen); ++i) DEBUG_PRINTF(isprint(*(url + i)) ? "%c" : "\\x%02x", *(url + i) & 0xFF);
if (urllen > 64) DEBUG_PRINTF("<...>");
DEBUG_PRINTF("\n");
// Skip over URL line and continue processing below
@@ -165,7 +166,7 @@ checkstate:
fprintf(stderr, "Error: negative nscan\n");
return 1;
}
if (nscan > n - (m0 - bufp)) {
if (m0 + nscan > bufp + n) {
fprintf(stderr, "Error: buffer overread\n");
return 1;
}
@@ -290,7 +291,7 @@ checkstate:
fprintf(stderr, "Error: negative nscan\n");
return 1;
}
if (nscan > n - (m0 - bufp)) {
if (m0 + nscan > bufp + n) {
fprintf(stderr, "Error: buffer overread\n");
return 1;
}


+ 1
- 1
warc-dump-responses.c View File

@@ -88,7 +88,7 @@ checkstate:
fprintf(stderr, "Error: negative nscan\n");
return 1;
}
if (nscan > n - (m0 - bufp)) {
if (m0 + nscan > bufp + n) {
fprintf(stderr, "Error: buffer overread\n");
return 1;
}


Loading…
Cancel
Save