summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-12-12 13:09:59 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2016-12-12 13:09:59 +0200
commit0f705faa6c5079c03319a49f37912f7f49bce6e1 (patch)
tree19147ee637ab553a60ebc08a5ff605122bbbabdb
parent506086e05f25c8082993940eac0883c7d72d485a (diff)
downloadmailutils-0f705faa6c5079c03319a49f37912f7f49bce6e1.tar.gz
mailutils-0f705faa6c5079c03319a49f37912f7f49bce6e1.tar.bz2
Bugfix
* libmailutils/base/ctparse.c (parse_type) (parse_subtype): Fix memory allocation
m---------gint0
-rw-r--r--libmailutils/base/ctparse.c4
2 files changed, 2 insertions, 2 deletions
diff --git a/gint b/gint
-Subproject 42f4712085b40173eaea58e14b1a579291a6fe3
+Subproject fd86bf7d44b0c970771830692ae7491447ebe8b
diff --git a/libmailutils/base/ctparse.c b/libmailutils/base/ctparse.c
index 6ccac5cc1..773466052 100644
--- a/libmailutils/base/ctparse.c
+++ b/libmailutils/base/ctparse.c
@@ -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);

Return to:

Send suggestions and report system problems to the System administrator.