mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-25 18:14:53 +00:00
Axel Lin correctly pointed out that there is no buffer overflow because smtp_server[SMTP_MAX_SERVERNAME_LEN + 1] - there is always room for terminating 0 byte
This commit is contained in:
parent
3611b583f5
commit
3073affaaf
@ -348,13 +348,13 @@ smtp_set_server_addr(const char* server)
|
||||
if (server != NULL) {
|
||||
len = strnlen(server, SMTP_MAX_SERVERNAME_LEN); /* strnlen: length WITHOUT terminating 0 byte */
|
||||
}
|
||||
if (len >= SMTP_MAX_SERVERNAME_LEN) {
|
||||
return ERR_MEM; /* too long or no room for terminating 0 byte */
|
||||
if (len > SMTP_MAX_SERVERNAME_LEN) {
|
||||
return ERR_MEM;
|
||||
}
|
||||
if (len != 0) {
|
||||
MEMCPY(smtp_server, server, len);
|
||||
}
|
||||
smtp_server[len] = 0;
|
||||
smtp_server[len] = 0; /* always OK because of smtp_server[SMTP_MAX_SERVERNAME_LEN + 1] */
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user