diff options
author | Werner Koch <wk@gnupg.org> | 2008-06-05 09:46:12 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2008-06-05 09:46:12 +0200 |
commit | b11af4cf50ff2f8de1fda9a77ebb4ccf5cc926c0 (patch) | |
tree | fe1ea0381e7b94e4b69e7322bf143569486cb61b /common | |
parent | Changes the header presented before requesting the user ID. (diff) | |
download | gnupg2-b11af4cf50ff2f8de1fda9a77ebb4ccf5cc926c0.tar.xz gnupg2-b11af4cf50ff2f8de1fda9a77ebb4ccf5cc926c0.zip |
As a failsafe measure use memcpy instead of strcpy in gnupg_copy_time.
Typo fix.
Diffstat (limited to 'common')
-rw-r--r-- | common/ChangeLog | 4 | ||||
-rw-r--r-- | common/gettime.c | 2 | ||||
-rw-r--r-- | common/util.h | 14 |
3 files changed, 15 insertions, 5 deletions
diff --git a/common/ChangeLog b/common/ChangeLog index 860d3cb69..af2025d1f 100644 --- a/common/ChangeLog +++ b/common/ChangeLog @@ -1,3 +1,7 @@ +2008-06-05 Werner Koch <wk@g10code.com> + + * util.h (gnupg_copy_time): Replace strcpy by memcpy. + 2008-05-26 Werner Koch <wk@g10code.com> * asshelp.c (send_one_option, send_pinentry_environment): use diff --git a/common/gettime.c b/common/gettime.c index 6b7411b2a..c4a9d4844 100644 --- a/common/gettime.c +++ b/common/gettime.c @@ -402,7 +402,7 @@ days_per_month (int y, int m) /* Convert YEAR, MONTH and DAY into the Julian date. We assume that - it is already noon; we dont; support dates before 1582-10-15. */ + it is already noon. We do not support dates before 1582-10-15. */ static unsigned long date2jd (int year, int month, int day) { 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; } |