diff options
Diffstat (limited to 'sed.c')
-rw-r--r-- | sed.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -309,7 +309,10 @@ static void parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr) | |||
309 | fatalError("bad format in edit expression\n"); | 309 | fatalError("bad format in edit expression\n"); |
310 | 310 | ||
311 | /* store the edit line text */ | 311 | /* store the edit line text */ |
312 | sed_cmd->editline = strdup(&editstr[3]); | 312 | /* make editline big enough to accomodate the extra '\n' we will tack on |
313 | * to the end */ | ||
314 | sed_cmd->editline = xmalloc(strlen(&editstr[3]) + 2); | ||
315 | strcpy(sed_cmd->editline, &editstr[3]); | ||
313 | ptr = sed_cmd->editline; | 316 | ptr = sed_cmd->editline; |
314 | 317 | ||
315 | /* now we need to go through * and: s/\\[\r\n]$/\n/g on the edit line */ | 318 | /* now we need to go through * and: s/\\[\r\n]$/\n/g on the edit line */ |