aboutsummaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-10-17 10:38:51 -0400
committerDamjan Marion <dmarion@me.com>2018-10-23 13:06:46 +0000
commitb7b929931a07fbb27b43d5cd105f366c3e29807e (patch)
tree438681c89738802dbb5d339715b96ea2c31bafb4 /src/tools
parentb9a4c445c1d4e9cdab476a8e1fb8a46ff0fc6080 (diff)
c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/elftool/elftool.c4
-rw-r--r--src/tools/g2/view1.c2
-rw-r--r--src/tools/perftool/cpel_util.c6
3 files changed, 6 insertions, 6 deletions
diff --git a/src/tools/elftool/elftool.c b/src/tools/elftool/elftool.c
index d9d3704b4a3..debd9089027 100644
--- a/src/tools/elftool/elftool.c
+++ b/src/tools/elftool/elftool.c
@@ -100,7 +100,7 @@ static clib_error_t * elf_set_interpreter (elf_main_t * em,
return error;
/* Put in new null terminated string. */
- memset (s->contents, 0, vec_len (s->contents));
+ clib_memset (s->contents, 0, vec_len (s->contents));
clib_memcpy (s->contents, interp, strlen (interp));
return 0;
@@ -375,7 +375,7 @@ int main (int argc, char * argv[])
unformat_input_t i;
clib_error_t * error = 0;
- memset (tm, 0, sizeof (tm[0]));
+ clib_memset (tm, 0, sizeof (tm[0]));
unformat_init_command_line (&i, argv);
while (unformat_check_input (&i) != UNFORMAT_END_OF_INPUT)
diff --git a/src/tools/g2/view1.c b/src/tools/g2/view1.c
index a4190cb1f27..9c86fcdcec4 100644
--- a/src/tools/g2/view1.c
+++ b/src/tools/g2/view1.c
@@ -1636,7 +1636,7 @@ static void init_track_colors(void)
if (s_color != NULL ) {
gdk_colormap_free_colors(gtk_widget_get_colormap(da),
s_color, g_npids);
- memset(s_color, 0, sizeof(GdkColor) * g_npids);
+ clib_memset(s_color, 0, sizeof(GdkColor) * g_npids);
} else {
/*
* First time through: allocate the array to hold the GCs.
diff --git a/src/tools/perftool/cpel_util.c b/src/tools/perftool/cpel_util.c
index 7ee9b6e2a00..4f5f98a51cc 100644
--- a/src/tools/perftool/cpel_util.c
+++ b/src/tools/perftool/cpel_util.c
@@ -210,7 +210,7 @@ int write_event_defs(FILE *ofp)
if (fwrite(&sh, sizeof(sh), 1, ofp) != 1)
return(0);
- memset(&edsh, 0, sizeof(edsh));
+ clib_memset(&edsh, 0, sizeof(edsh));
strcpy(edsh.string_table_name, "FileStrtab");
edsh.number_of_event_definitions = ntohl(vec_len(the_event_definitions));
@@ -274,7 +274,7 @@ int write_events(FILE *ofp, u64 clock_ticks_per_second)
if (fwrite(&sh, sizeof(sh), 1, ofp) != 1)
return(0);
- memset(&eh, 0, sizeof(eh));
+ clib_memset(&eh, 0, sizeof(eh));
strcpy(eh.string_table_name, "FileStrtab");
eh.number_of_events = ntohl(number_of_events);
eh.clock_ticks_per_second = ntohl(clock_ticks_per_second);
@@ -322,7 +322,7 @@ int write_track_defs(FILE *ofp)
if (fwrite(&sh, sizeof(sh), 1, ofp) != 1)
return(0);
- memset(&tdsh, 0, sizeof(tdsh));
+ clib_memset(&tdsh, 0, sizeof(tdsh));
strcpy(tdsh.string_table_name, "FileStrtab");
tdsh.number_of_track_definitions = ntohl(vec_len(the_tracks));