summaryrefslogtreecommitdiffstats
path: root/src/tools/g2
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2020-04-04 18:34:41 -0400
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-08-13 17:20:47 +0000
commit3d57cfdfb529c61fa5ec6e8a04db4ef042e7eb45 (patch)
tree147a67aa183dd1f961c2dd56b926c447e43f198b /src/tools/g2
parentd13034a6d1a239af07948ebe6a399c6aec5ddbbc (diff)
misc: strcpy be gone
Causes static analysis "vulnerability" warnings Type: fix Ticket: VPP-1837 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I272fa69251d70f62178e6dff0423c16f99937af1 (cherry picked from commit 0250090fc0c24214cb1fa969f6e2f585099ee36b)
Diffstat (limited to 'src/tools/g2')
-rw-r--r--src/tools/g2/mkversion.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/tools/g2/mkversion.c b/src/tools/g2/mkversion.c
index 3523fbe6c6d..0e22cfa86b5 100644
--- a/src/tools/g2/mkversion.c
+++ b/src/tools/g2/mkversion.c
@@ -1,4 +1,4 @@
-/*
+/*
*------------------------------------------------------------------
* Copyright (c) 1997-2016 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -44,21 +44,21 @@ int main (int argc, char **argv)
}
now = time (0);
-
+
fprintf (ofp, "/*\n");
fprintf (ofp, " * G2 Version Stamp, %s",
ctime (&now));
fprintf (ofp, " * Automatically generated, hand edits are pointless.\n");
fprintf (ofp, " */\n\n");
- fprintf (ofp,
+ fprintf (ofp,
"const char *version_string = \"G2 (%s) major version %s\";\n",
argv[1], argv[2]);
-
+
username = (char *) cuserid (0);
- strcpy(timestr, ctime(&now));
-
+ strncpy(timestr, ctime(&now), sizeof (timestr));
+
cp = timestr;
while (*cp) {
@@ -70,8 +70,6 @@ int main (int argc, char **argv)
fprintf (ofp,
"const char *minor_v_string = \"Built by %s at %s\";\n",
username, timestr);
-
+
exit (0);
}
-
-