From aa83bdf490a8b4573823619bfe48e2e75d9dbd49 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Mon, 19 Nov 2018 14:43:26 +0100 Subject: [PATCH] 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) --- src/apps/smtp/smtp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/apps/smtp/smtp.c b/src/apps/smtp/smtp.c index aa8380d6..2aa21ce0 100644 --- a/src/apps/smtp/smtp.c +++ b/src/apps/smtp/smtp.c @@ -65,7 +65,7 @@ #include "lwip/altcp_tcp.h" #include "lwip/altcp_tls.h" -#include /* strnlen, memcpy */ +#include /* strlen, memcpy */ #include /** 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;