mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-18 10:59:45 +00:00
Fix mg_straddr() stack overwrite
This commit is contained in:
1 parent
76e6b23a4f
commit
c4b5b37568
2 files changed
+2
-2
No files matched your search
+1
-1
@@ -3313,7 +3313,7 @@ size_t mg_printf(struct mg_connection *c, const char *fmt, ...) {
|
||||
}
|
||||
|
||||
char *mg_straddr(struct mg_addr *a, char *buf, size_t len) {
|
||||
char tmp[30];
|
||||
char tmp[40];
|
||||
const char *fmt = a->is_ip6 ? "[%s]:%d" : "%s:%d";
|
||||
mg_ntoa(a, tmp, sizeof(tmp));
|
||||
mg_snprintf(buf, len, fmt, tmp, (int) mg_ntohs(a->port));
|
||||
|
||||
@@ -21,7 +21,7 @@ size_t mg_printf(struct mg_connection *c, const char *fmt, ...) {
|
||||
}
|
||||
|
||||
char *mg_straddr(struct mg_addr *a, char *buf, size_t len) {
|
||||
char tmp[30];
|
||||
char tmp[40];
|
||||
const char *fmt = a->is_ip6 ? "[%s]:%d" : "%s:%d";
|
||||
mg_ntoa(a, tmp, sizeof(tmp));
|
||||
mg_snprintf(buf, len, fmt, tmp, (int) mg_ntohs(a->port));
|
||||
|
||||
Reference in new issue
Block a user