mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-05 06:39:52 +00:00
Fix bug #55034: apps/smtp.c fails to compile with strict C compatibility because of strnlen
by replacing strnlen with strlen. It's a user-supplied string, so we can assume it is correctly \0 terminated (as done several times elsewhere in the code) (cherry picked from commit aa83bdf490a8b4573823619bfe48e2e75d9dbd49)
This commit is contained in:
parent
98d1cb1c00
commit
66706f469d
@ -65,7 +65,7 @@
|
||||
#include "lwip/altcp_tcp.h"
|
||||
#include "lwip/altcp_tls.h"
|
||||
|
||||
#include <string.h> /* strnlen, memcpy */
|
||||
#include <string.h> /* strlen, memcpy */
|
||||
#include <stdlib.h>
|
||||
|
||||
/** TCP poll interval. Unit is 0.5 sec. */
|
||||
@ -353,9 +353,8 @@ smtp_set_server_addr(const char* server)
|
||||
LWIP_ASSERT_CORE_LOCKED();
|
||||
|
||||
if (server != NULL) {
|
||||
/* strnlen: returns length WITHOUT terminating 0 byte OR
|
||||
* SMTP_MAX_SERVERNAME_LEN+1 when string is too long */
|
||||
len = strnlen(server, SMTP_MAX_SERVERNAME_LEN+1);
|
||||
/* strlen: returns length WITHOUT terminating 0 byte */
|
||||
len = strlen(server);
|
||||
}
|
||||
if (len > SMTP_MAX_SERVERNAME_LEN) {
|
||||
return ERR_MEM;
|
||||
|
Loading…
x
Reference in New Issue
Block a user