From 8ee95e609fddf46168819c0ee769ce9823a239e6 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Thu, 5 Sep 2013 14:44:24 -0400 Subject: imfs: use safe string functions Replace strcpy and strcat with counted variants. --- cpukit/libfs/src/imfs/imfs_load_tar.c | 8 +++++--- 1 file 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); } /* -- cgit v1.2.3