[Asterisk-code-review] http.c: Fix NULL pointer dereference bug (asterisk[18])
Boris P. Korzun
asteriskteam at digium.com
Wed Dec 28 13:35:24 CST 2022
Boris P. Korzun has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19780 )
Change subject: http.c: Fix NULL pointer dereference bug
......................................................................
http.c: Fix NULL pointer dereference bug
If native HTTP is disabled but HTTPS is enabled and status page enabled
too, http is falling while loading. 'global_http_server' is referenced
to NULL, but the status page tries to dereference it.
The patch adds a check for HTTP is enabled.
ASTERISK-30379 #close
Change-Id: I11b02fc920b72aaed9c809fc43210523ccfdc249
---
M main/http.c
1 file changed, 26 insertions(+), 5 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/80/19780/1
diff --git a/main/http.c b/main/http.c
index 7f1ffe0..0f626e9 100644
--- a/main/http.c
+++ b/main/http.c
@@ -396,12 +396,16 @@
ast_str_append(&out, 0, "<tr><td><i>Server</i></td><td><b>%s</b></td></tr>\r\n", http_server_name);
ast_str_append(&out, 0, "<tr><td><i>Prefix</i></td><td><b>%s</b></td></tr>\r\n", prefix);
- ast_str_append(&out, 0, "<tr><td><i>Bind Address</i></td><td><b>%s</b></td></tr>\r\n",
- ast_sockaddr_stringify_addr(&global_http_server->args.old_address));
- ast_str_append(&out, 0, "<tr><td><i>Bind Port</i></td><td><b>%s</b></td></tr>\r\n",
- ast_sockaddr_stringify_port(&global_http_server->args.old_address));
+ if (global_http_server) {
+ ast_str_append(&out, 0, "<tr><td><i>Bind Address</i></td><td><b>%s</b></td></tr>\r\n",
+ ast_sockaddr_stringify_addr(&global_http_server->args.old_address));
+ ast_str_append(&out, 0, "<tr><td><i>Bind Port</i></td><td><b>%s</b></td></tr>\r\n",
+ ast_sockaddr_stringify_port(&global_http_server->args.old_address));
+ }
if (http_tls_cfg.enabled) {
- ast_str_append(&out, 0, "<tr><td><i>SSL Bind Port</i></td><td><b>%s</b></td></tr>\r\n",
+ ast_str_append(&out, 0, "<tr><td><i>TLS Bind Address</i></td><td><b>%s</b></td></tr>\r\n",
+ ast_sockaddr_stringify_addr(&https_desc.old_address));
+ ast_str_append(&out, 0, "<tr><td><i>TLS Bind Port</i></td><td><b>%s</b></td></tr>\r\n",
ast_sockaddr_stringify_port(&https_desc.old_address));
}
ast_str_append(&out, 0, "<tr><td colspan=\"2\"><hr></td></tr>\r\n");
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19780
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I11b02fc920b72aaed9c809fc43210523ccfdc249
Gerrit-Change-Number: 19780
Gerrit-PatchSet: 1
Gerrit-Owner: Boris P. Korzun <drtr0jan at yandex.ru>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221228/fa10d4a7/attachment-0001.html>
More information about the asterisk-code-review
mailing list