aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--common/ChangeLog4
-rw-r--r--common/gettime.c2
-rw-r--r--common/util.h14
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 <[email protected]>
+
+ * util.h (gnupg_copy_time): Replace strcpy by memcpy.
+
2008-05-26 Werner Koch <[email protected]>
* 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;
}