From: Vincent Pit Date: Tue, 20 Apr 2010 21:13:23 +0000 (+0200) Subject: When cloning a config, eallocate one char more for the name X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FSub-Op.git;a=commitdiff_plain;h=984cdc340cbc0920a576e89f27fe9ea3ea50feba When cloning a config, eallocate one char more for the name --- diff --git a/Op.xs b/Op.xs index 6a71219..d6dc30c 100644 --- a/Op.xs +++ b/Op.xs @@ -150,9 +150,10 @@ sub_op_config_t *sub_op_dup(pTHX_ const sub_op_config_t *orig) { sub_op_config_t *dupe = PerlMemShared_malloc(sizeof *dupe); len = orig->namelen; - if (len && orig->name) { - dupe->name = PerlMemShared_malloc(len); + if (orig->name) { + dupe->name = PerlMemShared_malloc(len + 1); Copy(orig->name, dupe->name, len, char); + ((char *) dupe->name)[len] = '\0'; } else { dupe->name = NULL; }