diff options
Diffstat (limited to '')
-rw-r--r-- | common/util.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/common/util.h b/common/util.h index 269aed193..7703be2b6 100644 --- a/common/util.h +++ b/common/util.h @@ -115,13 +115,19 @@ gpg_error_t add_days_to_isotime (gnupg_isotime_t atime, int ndays); gpg_error_t check_isotime (const gnupg_isotime_t atime); /* Copy one ISO date to another, this is inline so that we can do a - sanity check. */ + minimal sanity check. A null date (empty string) is allowed. */ static inline void gnupg_copy_time (gnupg_isotime_t d, const gnupg_isotime_t s) { - if (*s && (strlen (s) != 15 || s[8] != 'T')) - BUG(); - strcpy (d, s); + if (*s) + { + if ((strlen (s) != 15 || s[8] != 'T')) + BUG(); + memcpy (d, s, 15); + d[15] = 0; + } + else + *d = 0; } |