diff options
| author | Dirk Ziegelmeier <[email protected]> | 2018-11-19 14:43:26 +0100 |
|---|---|---|
| committer | Dirk Ziegelmeier <[email protected]> | 2018-11-19 14:48:54 +0100 |
| commit | 66706f469d36d0100183e9c2c52d76bc88b50d9f (patch) | |
| tree | 0a2ef2885214ea51c0df811b51d8469eaa7c12a2 | |
| parent | 98d1cb1c000577468e2b1b54137b4bb37f161f85 (diff) | |
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)
| -rw-r--r-- | src/apps/smtp/smtp.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/apps/smtp/smtp.c b/src/apps/smtp/smtp.c index 8a87533a..55303c35 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 <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; |
