As a failsafe measure use memcpy instead of strcpy in gnupg_copy_time.

Typo fix.
This commit is contained in:
Werner Koch 2008-06-05 07:46:12 +00:00
parent 49b2db7636
commit b11af4cf50
3 changed files with 15 additions and 5 deletions

View File

@ -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

View File

@ -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)
{

View File

@ -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;
}