diff options
author | kraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-05-27 14:11:52 +0000 |
---|---|---|
committer | kraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-05-27 14:11:52 +0000 |
commit | feec82aabad2d873692affce09e7fe319ae00f73 (patch) | |
tree | 7a46a06c0f29438cd2ad867e5b8de07afe92b88a /sed.c | |
parent | bd5d79783f5be594aa6f4a28ae1368c6af3a3530 (diff) | |
download | busybox-w32-feec82aabad2d873692affce09e7fe319ae00f73.tar.gz busybox-w32-feec82aabad2d873692affce09e7fe319ae00f73.tar.bz2 busybox-w32-feec82aabad2d873692affce09e7fe319ae00f73.zip |
Use safe_strncpy.
git-svn-id: svn://busybox.net/trunk/busybox@2753 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'sed.c')
-rw-r--r-- | sed.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -388,9 +388,8 @@ static int parse_file_cmd(struct sed_cmd *sed_cmd, const char *filecmdstr) | |||
388 | /* the first non-whitespace we get is a filename. the filename ends when we | 388 | /* the first non-whitespace we get is a filename. the filename ends when we |
389 | * hit a normal sed command terminator or end of string */ | 389 | * hit a normal sed command terminator or end of string */ |
390 | filenamelen = strcspn(&filecmdstr[idx], "; \n\r\t\v\0"); | 390 | filenamelen = strcspn(&filecmdstr[idx], "; \n\r\t\v\0"); |
391 | sed_cmd->filename = xmalloc(sizeof(char) * filenamelen + 1); | 391 | sed_cmd->filename = xmalloc(filenamelen + 1); |
392 | strncpy(sed_cmd->filename, &filecmdstr[idx], filenamelen); | 392 | safe_strncpy(sed_cmd->filename, &filecmdstr[idx], filenamelen + 1); |
393 | sed_cmd->filename[filenamelen] = 0; | ||
394 | 393 | ||
395 | return idx + filenamelen; | 394 | return idx + filenamelen; |
396 | } | 395 | } |