Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jun 2019 16:30:15 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349420 - head/contrib/elftoolchain/libelftc
Message-ID:  <201906261630.x5QGUFGE046199@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Jun 26 16:30:14 2019
New Revision: 349420
URL: https://svnweb.freebsd.org/changeset/base/349420

Log:
  libelftc: Micro-optimize string table insertion.
  
  The string's length is already known, so use memcpy() instead of
  strcpy() to add it to the string table image.
  
  Reviewed by:	emaste
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D20760

Modified:
  head/contrib/elftoolchain/libelftc/elftc_string_table.c

Modified: head/contrib/elftoolchain/libelftc/elftc_string_table.c
==============================================================================
--- head/contrib/elftoolchain/libelftc/elftc_string_table.c	Wed Jun 26 16:28:42 2019	(r349419)
+++ head/contrib/elftoolchain/libelftc/elftc_string_table.c	Wed Jun 26 16:30:14 2019	(r349420)
@@ -119,7 +119,7 @@ elftc_string_table_add_to_pool(Elftc_String_Table *st,
 		st->st_string_pool_size = newsize;
 	}
 
-	strcpy(st->st_string_pool + stlen, string);
+	memcpy(st->st_string_pool + stlen, string, len);
 	ELFTC_STRING_TABLE_UPDATE_LENGTH(st, stlen + len);
 
 	return (stlen);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906261630.x5QGUFGE046199>