sscanf is used to get the value of x-debuginfod-size from the http
headers. The format string used assumes that the header field name
is entirely lower case. However mixed-case field names are possible,
resulting in the value not being read.
Fix this by removing "x-debuginfod-size" from the format string.
Signed-off-by: Aaron Merey <amerey@redhat.com>
+2023-03-30 Aaron Merey <amerey@redhat.com>
+
+ * debuginfod-client.c (debuginfod_query_server): Avoid sscanf on
+ mixed-case component of string.
+
2023-03-29 Jan Alexander Steffens (heftig) <heftig@archlinux.org>
* debuginfod-client.c (debuginfod_query_server): s/futimes/futimens/
{
long xdl;
char *hdr = strcasestr(c->winning_headers, "x-debuginfod-size");
+ size_t off = strlen("x-debuginfod-size:");
- if (hdr != NULL
- && sscanf(hdr, "x-debuginfod-size: %ld", &xdl) == 1)
+ if (hdr != NULL && sscanf(hdr + off, "%ld", &xdl) == 1)
dl_size = xdl;
}
}