ssl_mail_client: Replace snprintf with mbedtls_snprintf

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
This commit is contained in:
Mingjie Shen 2024-03-12 16:00:28 -04:00
parent 7d08983cb2
commit 0fc20cd447

View File

@ -727,7 +727,7 @@ usage:
mbedtls_printf(" > Write MAIL FROM to server:");
fflush(stdout);
len = snprintf((char *) buf, sizeof(buf), "MAIL FROM:<%s>\r\n", opt.mail_from);
len = mbedtls_snprintf((char *) buf, sizeof(buf), "MAIL FROM:<%s>\r\n", opt.mail_from);
ret = write_ssl_and_get_response(&ssl, buf, len);
if (ret < 200 || ret > 299) {
mbedtls_printf(" failed\n ! server responded with %d\n\n", ret);
@ -739,7 +739,7 @@ usage:
mbedtls_printf(" > Write RCPT TO to server:");
fflush(stdout);
len = snprintf((char *) buf, sizeof(buf), "RCPT TO:<%s>\r\n", opt.mail_to);
len = mbedtls_snprintf((char *) buf, sizeof(buf), "RCPT TO:<%s>\r\n", opt.mail_to);
ret = write_ssl_and_get_response(&ssl, buf, len);
if (ret < 200 || ret > 299) {
mbedtls_printf(" failed\n ! server responded with %d\n\n", ret);
@ -763,7 +763,7 @@ usage:
mbedtls_printf(" > Write content to server:");
fflush(stdout);
len = snprintf((char *) buf, sizeof(buf),
len = mbedtls_snprintf((char *) buf, sizeof(buf),
"From: %s\r\nSubject: Mbed TLS Test mail\r\n\r\n"
"This is a simple test mail from the "
"Mbed TLS mail client example.\r\n"