From 49fb1c503333fd9b7738b2d5eddfa1e775cd93f2 Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Fri, 30 Jul 2010 12:44:32 +0000 Subject: =?UTF-8?q?2010-07-30=09Ralf=20Cors=C3=A9pius=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * rtems-bin2c.c: Fix memory leak in '.c' suffix strip. Also strip '.h' suffix. --- tools/build/ChangeLog | 5 +++++ tools/build/rtems-bin2c.c | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'tools/build') diff --git a/tools/build/ChangeLog b/tools/build/ChangeLog index b1cb6d16d1..70bed699c5 100644 --- a/tools/build/ChangeLog +++ b/tools/build/ChangeLog @@ -1,3 +1,8 @@ +2010-07-30 Ralf Corsépius + + * rtems-bin2c.c: Fix memory leak in '.c' suffix strip. + Also strip '.h' suffix. + 2010-07-30 Ralf Corsépius * rtems-bin2c.c: Make -v (verbose) working. diff --git a/tools/build/rtems-bin2c.c b/tools/build/rtems-bin2c.c index 28148dc70a..4e6796aa38 100644 --- a/tools/build/rtems-bin2c.c +++ b/tools/build/rtems-bin2c.c @@ -70,8 +70,12 @@ void process(const char *ifname, const char *ofname) strncpy( obasename, ofname, PATH_MAX ); len = strlen( obasename ); - if ( obasename[len-2] == '.' && obasename[len-1] == 'c' ) - obasename[len-2] = '\0'; + if ( len >= 2 ) { + if ( obasename[len-2] == '.' ) { + if ( (obasename[len-1] == 'c') || (obasename[len-1] == 'h') ) + obasename[len-2] = '\0'; + } + } sprintf( ocname, "%s.c", obasename ); sprintf( ohname, "%s.h", obasename ); -- cgit v1.2.3