diff options
author | Gedare Bloom <gedare@rtems.org> | 2013-09-05 14:44:24 -0400 |
---|---|---|
committer | Gedare Bloom <gedare@rtems.org> | 2013-09-05 14:44:24 -0400 |
commit | 8ee95e609fddf46168819c0ee769ce9823a239e6 (patch) | |
tree | 0b003ed9ce9c56250b205a95696e5e49b7bc38a2 | |
parent | termios: check return value from semaphore obtain/release (diff) | |
download | rtems-8ee95e609fddf46168819c0ee769ce9823a239e6.tar.bz2 |
imfs: use safe string functions
Replace strcpy and strcat with counted variants.
-rw-r--r-- | cpukit/libfs/src/imfs/imfs_load_tar.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cpukit/libfs/src/imfs/imfs_load_tar.c b/cpukit/libfs/src/imfs/imfs_load_tar.c index abb9f46e36..fd47ec2380 100644 --- a/cpukit/libfs/src/imfs/imfs_load_tar.c +++ b/cpukit/libfs/src/imfs/imfs_load_tar.c @@ -100,10 +100,12 @@ int rtems_tarfs_load( * - For files, create a file node with special tarfs properties. */ if (linkflag == DIRTYPE) { - strcpy(full_filename, mountpoint); - if (full_filename[strlen(full_filename)-1] != '/') + int len; + strncpy(full_filename, mountpoint, 255); + if (full_filename[(len=strlen(full_filename))-1] != '/') strcat(full_filename, "/"); - strcat(full_filename, filename); + ++len; + strncat(full_filename, filename, 256-len-1); rv = mkdir(full_filename, S_IRWXU | S_IRWXG | S_IRWXO); } /* |