aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/http
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-10-04 17:17:59 -0700
committerGarrett D'Amore <garrett@damore.org>2025-10-04 17:57:56 -0700
commitd6eeff578cc8e2ada1a80f4d1ddaa098931f9a7d (patch)
tree3936c13e3ccd42faf0936d3220cffe81b1884153 /src/supplemental/http
parent37fe4eff0e23ffbc251034b8001a1065c55f9951 (diff)
downloadnng-d6eeff578cc8e2ada1a80f4d1ddaa098931f9a7d.tar.gz
nng-d6eeff578cc8e2ada1a80f4d1ddaa098931f9a7d.tar.bz2
nng-d6eeff578cc8e2ada1a80f4d1ddaa098931f9a7d.zip
fixes #2165 nng_http_handler_alloc_static crashes if content type is null
Diffstat (limited to 'src/supplemental/http')
-rw-r--r--src/supplemental/http/http_server.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/supplemental/http/http_server.c b/src/supplemental/http/http_server.c
index 2273e3be..fc7a3075 100644
--- a/src/supplemental/http/http_server.c
+++ b/src/supplemental/http/http_server.c
@@ -1571,6 +1571,9 @@ nni_http_handler_init_static(nni_http_handler **hpp, const char *uri,
if ((hs = NNI_ALLOC_STRUCT(hs)) == NULL) {
return (NNG_ENOMEM);
}
+ if (ctype == NULL) {
+ ctype = "application/octet-stream";
+ }
if (((hs->ctype = nni_strdup(ctype)) == NULL) ||
((size > 0) && ((hs->data = nni_alloc(size)) == NULL))) {
http_static_free(hs);