Browse Source

backport c-c 1584473 - Fix wrong arguments to memset(), snprintf(), strncmp() in libical.

tags/v2.2
Gaming4JC 6 months ago
parent
commit
5063489863
No account linked to committer's email address
4 changed files with 10 additions and 12 deletions
  1. +2
    -2
      calendar/libical/src/libical/icalmime.c
  2. +1
    -1
      calendar/libical/src/libical/icalparameter.c
  3. +5
    -5
      calendar/libical/src/libical/icaltimezone.c
  4. +2
    -4
      calendar/libical/src/libical/sspm.c

+ 2
- 2
calendar/libical/src/libical/icalmime.c View File

@@ -192,7 +192,7 @@ icalcomponent* icalmime_parse(char* (*get_string)(char *s, size_t size,
return 0;
}

memset(parts,0,sizeof(parts));
memset(parts,0,sizeof(NUM_PARTS*sizeof(struct sspm_part)));

sspm_parse_mime(parts,
NUM_PARTS, /* Max parts */
@@ -382,7 +382,7 @@ int icalmime_test(char* (*get_string)(char *s, size_t size, void *d),
return 0;
}

memset(parts,0,sizeof(parts));
memset(parts,0,sizeof(NUM_PARTS*sizeof(struct sspm_part)));

sspm_parse_mime(parts,
NUM_PARTS, /* Max parts */

+ 1
- 1
calendar/libical/src/libical/icalparameter.c View File

@@ -111,7 +111,7 @@ icalparameter_free (icalparameter* param)
free ((void*)param->x_name);
}
memset(param,0,sizeof(param));
memset(param,0,sizeof(icalparameter));

param->parent = 0;
param->id[0] = 'X';

+ 5
- 5
calendar/libical/src/libical/icaltimezone.c View File

@@ -164,7 +164,7 @@ static char* icaltimezone_load_get_line_fn (char *s,
#endif

static void format_utc_offset (int utc_offset,
char *buffer);
char *buffer, size_t buffer_size);
static const char* get_zone_directory(void);

/** Creates a new icaltimezone. */
@@ -1868,7 +1868,7 @@ icaltimezone_dump_changes (icaltimezone *zone,
zone_change->hour, zone_change->minute, zone_change->second);

/* Wall Clock Time offset from UTC. */
format_utc_offset (zone_change->utc_offset, buffer);
format_utc_offset (zone_change->utc_offset, buffer, sizeof(buffer));
fprintf (fp, "\t%s", buffer);

fprintf (fp, "\n");
@@ -1881,7 +1881,7 @@ icaltimezone_dump_changes (icaltimezone *zone,
buffer should have space for 8 characters. */
static void
format_utc_offset (int utc_offset,
char *buffer)
char *buffer, size_t buffer_size)
{
const char *sign = "+";
int hours, minutes, seconds;
@@ -1905,9 +1905,9 @@ format_utc_offset (int utc_offset,
}

if (seconds == 0)
snprintf (buffer, sizeof(buffer), "%s%02i%02i", sign, hours, minutes);
snprintf (buffer, buffer_size, "%s%02i%02i", sign, hours, minutes);
else
snprintf (buffer, sizeof(buffer), "%s%02i%02i%02i", sign, hours, minutes, seconds);
snprintf (buffer, buffer_size, "%s%02i%02i%02i", sign, hours, minutes, seconds);
}

static const char* get_zone_directory(void)

+ 2
- 4
calendar/libical/src/libical/sspm.c View File

@@ -704,8 +704,7 @@ void* sspm_make_part(struct mime_impl *impl,
break;
}
if(strncmp((line+2),parent_header->boundary,
sizeof(parent_header->boundary)) == 0){
if(strcmp((line+2),parent_header->boundary) == 0) {
*end_part = action.end_part(part);

if(sspm_is_mime_boundary(line)){
@@ -810,8 +809,7 @@ void* sspm_make_multipart_subpart(struct mime_impl *impl,

/* Check if it is the right boundary */
if(!sspm_is_mime_terminating_boundary(line) &&
strncmp((line+2),parent_header->boundary,
sizeof(parent_header->boundary))
strcmp((line+2),parent_header->boundary)
== 0){
/* The +2 in strncmp skips over the leading "--" */

Loading…
Cancel
Save