summaryrefslogtreecommitdiff
path: root/main/stdtime/localtime.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/stdtime/localtime.c')
-rw-r--r--main/stdtime/localtime.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/main/stdtime/localtime.c b/main/stdtime/localtime.c
index 3460307a2..7dd3a6928 100644
--- a/main/stdtime/localtime.c
+++ b/main/stdtime/localtime.c
@@ -2365,7 +2365,11 @@ char *ast_strptime_locale(const char *s, const char *format, struct ast_tm *tm,
prevlocale = ast_setlocale(locale);
res = strptime(s, format, &tm2);
ast_setlocale(prevlocale);
- memcpy(tm, &tm2, sizeof(*tm));
+ /* ast_time and tm are not the same size - tm is a subset of
+ * ast_time. Hence, the size of tm needs to be used for the
+ * memcpy
+ */
+ memcpy(tm, &tm2, sizeof(tm2));
tm->tm_usec = 0;
/* strptime(3) doesn't set .tm_isdst correctly, so to force ast_mktime(3)
* to deal with it correctly, we set it to -1. */