Add more bytes to SMTP_DATE_MAX_SZ define to silence recent compiler warnings. The previous size was enough to contain the maximum possible size. Remove the redefinition of that size in the test header.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
diff --git a/src/smtp.c b/src/smtp.c
index 85a0fee..61b9b9b 100644
--- a/src/smtp.c
+++ b/src/smtp.c
@@ -2199,7 +2199,7 @@ smtp_initiate_handshake(struct smtp *const smtp,
Add more bytes to the 32 maximum size to silence compiler warning on the
computed UTF offset.
*/
-#define SMTP_DATE_MAX_SZ (32 + 5)
+#define SMTP_DATE_MAX_SZ (32 + 15)
/**
* Convert the time into an RFC 2822 formatted string.
@@ -2291,7 +2291,7 @@ smtp_date_rfc_2822(char *const date){
tm_local.tm_sec, /* 0 - 60 (leap second) */
offset_utc);
- if(rc + 1 != SMTP_DATE_MAX_SZ - 5){ /* See @ref SMTP_DATE_MAX_SZ for -5. */
+ if(rc + 1 != SMTP_DATE_MAX_SZ - 15){ /* See @ref SMTP_DATE_MAX_SZ for -5. */
return -1;
}
diff --git a/test/test.c b/test/test.c
index 7552b38..1b3d7cd 100644
--- a/test/test.c
+++ b/test/test.c
@@ -1488,7 +1488,7 @@ static void
smtp_unit_test_date_rfc_2822(time_t t,
const char *const expect,
int expect_rc){
- char result[SMTP_DATE_MAX_SZ];
+ char result[1000];
int rc;
g_smtp_test_time_custom_ret = 1;
diff --git a/test/test.h b/test/test.h
index b636bd0..35b48c5 100644
--- a/test/test.h
+++ b/test/test.h
@@ -47,14 +47,6 @@
struct smtp_command;
struct str_getdelimfd;
-/**
- * Maximum size of an RFC 2822 date string.
- *
- * Also defined in @ref smtp.c. Redefined here because the unit tests
- * need to use this max size when calling the @ref smtp_date_rfc_2822 function.
- */
-#define SMTP_DATE_MAX_SZ (32 + 5)
-
int
smtp_si_add_size_t(const size_t a,
const size_t b,