aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/gen-bout
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2019-08-13 20:28:51 +0100
committerMartinNowack <martin.nowack@gmail.com>2019-08-14 16:26:48 +0100
commitdc414fde33f3ec22a6ae3cf29cfc6bc4a9ddae1a (patch)
tree56c1467c47fd45bdc2e3bad46b9b82b4186d4b8f /tools/gen-bout
parent8426b2913e650970d46be9a4d088bf3945f41453 (diff)
downloadklee-dc414fde33f3ec22a6ae3cf29cfc6bc4a9ddae1a.tar.gz
Replace sprintf with snprintf throughout codebase
Diffstat (limited to 'tools/gen-bout')
-rw-r--r--tools/gen-bout/gen-bout.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/gen-bout/gen-bout.cpp b/tools/gen-bout/gen-bout.cpp
index dfc02fda..477c302b 100644
--- a/tools/gen-bout/gen-bout.cpp
+++ b/tools/gen-bout/gen-bout.cpp
@@ -134,13 +134,13 @@ int main(int argc, char *argv[]) {
static int total_args = 0;
char arg[1024];
- sprintf(arg, "arg%d", total_args++);
+ snprintf(arg, sizeof(arg), "arg%d", total_args++);
push_obj(&b, (const char *)arg, nbytes, (unsigned char *)argv[i]);
char *buf1 = (char *)malloc(1024);
char *buf2 = (char *)malloc(1024);
strcpy(buf1, "-sym-arg");
- sprintf(buf2, "%ld", nbytes - 1);
+ snprintf(buf2, 1024, "%ld", nbytes - 1);
argv_copy[argv_copy_idx++] = buf1;
argv_copy[argv_copy_idx++] = buf2;
}
@@ -182,9 +182,9 @@ int main(int argc, char *argv[]) {
char *buf1 = (char *)malloc(1024);
char *buf2 = (char *)malloc(1024);
char *buf3 = (char *)malloc(1024);
- sprintf(buf1, "-sym-files");
- sprintf(buf2, "1");
- sprintf(buf3, "%ld", nbytes);
+ snprintf(buf1, 1024, "-sym-files");
+ snprintf(buf2, 1024, "1");
+ snprintf(buf3, 1024, "%ld", nbytes);
argv_copy[argv_copy_idx++] = buf1;
argv_copy[argv_copy_idx++] = buf2;
argv_copy[argv_copy_idx++] = buf3;
@@ -222,8 +222,8 @@ int main(int argc, char *argv[]) {
char *buf1 = (char *)malloc(1024);
char *buf2 = (char *)malloc(1024);
- sprintf(buf1, "-sym-stdin");
- sprintf(buf2, "%ld", file_stat.st_size);
+ snprintf(buf1, 1024, "-sym-stdin");
+ snprintf(buf2, 1024, "%ld", file_stat.st_size);
argv_copy[argv_copy_idx++] = buf1;
argv_copy[argv_copy_idx++] = buf2;
}
@@ -257,7 +257,7 @@ int main(int argc, char *argv[]) {
push_obj(&b, statname, sizeof(struct stat64), (unsigned char *)&file_stat);
char *buf = (char *)malloc(1024);
- sprintf(buf, "-sym-stdout");
+ snprintf(buf, 1024, "-sym-stdout");
argv_copy[argv_copy_idx++] = buf;
}