From: Craig A. Berry <craigberry@mac.com>
Date: Sat, 11 Mar 2006 01:52:37 +0000 (+0000)
Subject: null terminate command string -- broken in #27438
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b011c7bd39d14e47dbc58c5c24b1aec8c961a3d9;p=p5sagit%2Fp5-mst-13.2.git

null terminate command string -- broken in #27438

p4raw-id: //depot/perl@27467
---

diff --git a/vms/vms.c b/vms/vms.c
index 82169ad..22c5809 100644
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -8546,9 +8546,9 @@ setup_cmddsc(pTHX_ const char *incmd, int check_img, int *suggest_quote,
   /* It's either a DCL command or we couldn't find a suitable image */
   vmscmd->dsc$w_length = strlen(cmd);
 
-  vmscmd->dsc$a_pointer = PerlMem_malloc(vmscmd->dsc$w_length);
+  vmscmd->dsc$a_pointer = PerlMem_malloc(vmscmd->dsc$w_length + 1);
   strncpy(vmscmd->dsc$a_pointer,cmd,vmscmd->dsc$w_length);
-  vmscmd->dsc$a_pointer[vmscmd->dsc$w_length];
+  vmscmd->dsc$a_pointer[vmscmd->dsc$w_length] = 0;
 
   PerlMem_free(cmd);