Skip to content

Commit

Permalink
vcardtime.c: create and use TIME_BUF_SIZE
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmurchison committed Apr 21, 2024
1 parent 64198f2 commit 2d508f3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libicalvcard/vcardtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <string.h>
#include <time.h>

#define TIME_BUF_SIZE 21

vcardtimetype vcardtime_null_datetime(void)
{
vcardtimetype t = { -1, -1, -1, -1, -1, -1, -1 };
Expand Down Expand Up @@ -195,7 +197,7 @@ static int sprintf_time(const vcardtimetype t, int need_designator,
char *vcardtime_as_vcard_string_r(const vcardtimetype t,
int need_time_designator)
{
size_t size = 21;
size_t size = TIME_BUF_SIZE;
char *ptr, *buf;
int n;

Expand Down Expand Up @@ -229,7 +231,7 @@ const char *vcardtime_as_vcard_string(const vcardtimetype t,

static const char *sscanf_date(const char *str, vcardtimetype *t)
{
char fmt[21] = ""; /* 4 numeric arguments by position + NUL */
char fmt[TIME_BUF_SIZE] = ""; /* 4 numeric arguments by position + NUL */
const char *month;
size_t ndig;
int nchar;
Expand Down

0 comments on commit 2d508f3

Please sign in to comment.