Commit 0f705faa 0f705faa6c5079c03319a49f37912f7f49bce6e1 by Sergey Poznyakoff

Bugfix

* libmailutils/base/ctparse.c (parse_type)
(parse_subtype): Fix memory allocation
1 parent 506086e0
gint @ fd86bf7d
Subproject commit 42f4712085b40173eaea58e14b1a579291a6fe3a
Subproject commit fd86bf7d44b0c970771830692ae7491447ebe8b1
......
......@@ -60,7 +60,7 @@ parse_type (const char *input, mu_content_type_t ct)
|| !(mu_isalnum (input[i]) || input[i] == '-' || input[i] == '_'))
return MU_ERR_PARSE;
}
ct->type = malloc (i);
ct->type = malloc (i + 1);
if (!ct->type)
return ENOMEM;
memcpy (ct->type, input, i);
......@@ -83,7 +83,7 @@ parse_subtype (const char *input, mu_content_type_t ct)
if (!ISTOKEN (input[i]))
return MU_ERR_PARSE;
}
ct->subtype = malloc (i);
ct->subtype = malloc (i + 1);
if (!ct->subtype)
return ENOMEM;
memcpy (ct->subtype, input, i);
......