summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Griffis <pgriffis@igalia.com>2020-12-16 15:54:32 -0600
committerPatrick Griffis <pgriffis@igalia.com>2020-12-16 15:54:32 -0600
commitb0fd7e1f65049b7efdf50febe6765039de4289ed (patch)
tree8b05cf3166c82d65aed81981c8ed157a9e8875c3
parent19f85ec171d1d37e04135284ecef8e7155a89d02 (diff)
downloadlibsoup-b0fd7e1f65049b7efdf50febe6765039de4289ed.tar.gz
Handle sniffing bytes with 0 size
-rw-r--r--libsoup/content-sniffer/soup-content-sniffer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libsoup/content-sniffer/soup-content-sniffer.c b/libsoup/content-sniffer/soup-content-sniffer.c
index cb4255ad..cf5da7e1 100644
--- a/libsoup/content-sniffer/soup-content-sniffer.c
+++ b/libsoup/content-sniffer/soup-content-sniffer.c
@@ -507,6 +507,9 @@ sniff_unknown (SoupContentSniffer *sniffer, GBytes *buffer,
resource_length = MIN (512, resource_length);
guint i;
+ if (resource_length == 0)
+ return g_strdup ("application/octet-stream");
+
for (i = 0; i < G_N_ELEMENTS (types_table); i++) {
SoupContentSnifferPattern *type_row = &(types_table[i]);