[Asterisk-code-review] http.c: Fix NULL pointer dereference bug (asterisk[master])
Boris P. Korzun
asteriskteam at digium.com
Mon Jan 2 13:58:02 CST 2023
Boris P. Korzun has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19801 )
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, Core/HTTP crashes while loading. 'global_http_server' references
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, 23 insertions(+), 4 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/01/19801/1
diff --git a/main/http.c b/main/http.c
index 7f1ffe0..80c00c5 100644
--- a/main/http.c
+++ b/main/http.c
@@ -396,10 +396,12 @@
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_sockaddr_stringify_port(&https_desc.old_address));
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19801
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I11b02fc920b72aaed9c809fc43210523ccfdc249
Gerrit-Change-Number: 19801
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/20230102/bca020eb/attachment-0001.html>
More information about the asterisk-code-review
mailing list