This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/binutils-2_26-branch] Fix building objcopy under mingw64


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f34cdbd2ad208d02188acef0f5291a42495a0e4e

commit f34cdbd2ad208d02188acef0f5291a42495a0e4e
Author: Thomas Preud'homme <thomas.preudhomme@arm.com>
Date:   Wed Nov 25 14:29:00 2015 +0800

    Fix building objcopy under mingw64
    
    2015-11-25  Tejas Belagod  <tejas.belagod@arm.com>
    
        Backport from mainline:
        2015-11-20  Ronald Hoogenboom  <hoogenboom30@zonnet.nl>
    
        * objcopy.c (parse_symflags): Use xstrndup in place of strndup.
        (copy_main): Likewise.

Diff:
---
 binutils/ChangeLog | 8 ++++++++
 binutils/objcopy.c | 6 +++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index caff375..99b3f08 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,11 @@
+2015-11-25  Tejas Belagod  <tejas.belagod@arm.com>
+
+	Backport from mainline:
+	2015-11-20  Ronald Hoogenboom  <hoogenboom30@zonnet.nl>
+
+	* objcopy.c (parse_symflags): Use xstrndup in place of strndup.
+	(copy_main): Likewise.
+
 2015-11-20  Nick Clifton  <nickc@redhat.com>
 
 	* po/ca.po: New Catalan translation.
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 0ff8525..4a9f043 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -771,7 +771,7 @@ parse_symflags (const char *s, char **other)
 
 #define PARSE_OTHER(fname,fval)								   \
       else if (len >= (int) sizeof fname && strncasecmp (fname, s, sizeof fname - 1) == 0) \
-	fval = strndup (s + sizeof fname - 1, len - sizeof fname + 1)
+	fval = xstrndup (s + sizeof fname - 1, len - sizeof fname + 1)
       
       if (0) ;
       PARSE_FLAG ("local", BSF_LOCAL);
@@ -4082,10 +4082,10 @@ copy_main (int argc, char *argv[])
 	      fatal (_("bad format for %s"), "--add-symbol");
 	    t = strchr (s + 1, ':');
 
-	    newsym->symdef = strndup (optarg, s - optarg);
+	    newsym->symdef = xstrndup (optarg, s - optarg);
 	    if (t)
 	      {
-		newsym->section = strndup (s + 1, t - (s + 1));
+		newsym->section = xstrndup (s + 1, t - (s + 1));
 		newsym->symval = strtol (t + 1, NULL, 0);
 	      }
 	    else


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]