1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
--- src/build.c.orig 2003-03-05 10:43:59.000000000 +0000
+++ src/build.c 2006-05-29 14:34:26.000000000 +0100
@@ -215,7 +215,7 @@
(void) strcpy(newdir, "$HOME");
}
else if (strncmp(currentdir, home, strlen(home)) == 0) {
- (void) sprintf(newdir, "$HOME%s", currentdir + strlen(home));
+ (void) snprintf(newdir, sizeof(newdir), "$HOME%s", currentdir + strlen(home));
}
/* sort the source file names (needed for rebuilding) */
qsort(srcfiles, (unsigned) nsrcfiles, sizeof(char *), compare);
@@ -443,7 +443,7 @@
}
(void) fstat(fileno(postings), &statstruct);
(void) fclose(postings);
- (void) sprintf(sortcommand, "env LC_ALL=C sort -T %s %s", tmpdir, temp1);
+ (void) snprintf(sortcommand, sizeof(sortcommand), "env LC_ALL=C sort -T %s %s", tmpdir, temp1);
if ((postings = mypopen(sortcommand, "r")) == NULL) {
(void) fprintf(stderr, "cscope: cannot open pipe to sort command\n");
cannotindex();
|