66 lines
2.1 KiB
Text
66 lines
2.1 KiB
Text
$NetBSD: patch-ah,v 1.7 2007/01/20 23:39:44 wiz Exp $
|
|
|
|
--- src/dir.c.orig 2006-09-30 10:13:00.000000000 +0200
|
|
+++ src/dir.c
|
|
@@ -139,7 +139,7 @@ sourcedir(char *dirlist)
|
|
|
|
/* compute its path from higher view path source dirs */
|
|
for (i = 1; i < nvpsrcdirs; ++i) {
|
|
- sprintf(path, "%.*s/%s",
|
|
+ snprintf(path, sizeof(path), "%.*s/%s",
|
|
PATHLEN - 2 - dir_len,
|
|
srcdirs[i], dir);
|
|
addsrcdir(path);
|
|
@@ -207,7 +207,7 @@ includedir(char *dirlist)
|
|
|
|
/* compute its path from higher view path source dirs */
|
|
for (i = 1; i < nvpsrcdirs; ++i) {
|
|
- sprintf(path, "%.*s/%s",
|
|
+ snprintf(path, sizeof(path), "%.*s/%s",
|
|
PATHLEN - 2 - dir_len,
|
|
srcdirs[i], dir);
|
|
addincdir(dir, path);
|
|
@@ -482,8 +482,6 @@ scan_dir(const char *adir, BOOL recurse_
|
|
DIR *dirfile;
|
|
int adir_len = strlen(adir);
|
|
|
|
- /* FIXME: no guards against adir_len > PATHLEN, yet */
|
|
-
|
|
if ((dirfile = opendir(adir)) != NULL) {
|
|
struct dirent *entry;
|
|
char path[PATHLEN + 1];
|
|
@@ -494,7 +492,7 @@ scan_dir(const char *adir, BOOL recurse_
|
|
&& (strcmp("..",entry->d_name) != 0)) {
|
|
struct stat buf;
|
|
|
|
- sprintf(path,"%s/%.*s", adir,
|
|
+ snprintf(path, sizeof(path), "%s/%.*s", adir,
|
|
PATHLEN - 2 - adir_len,
|
|
entry->d_name);
|
|
|
|
@@ -604,14 +602,14 @@ incfile(char *file, char *type)
|
|
/* search for the file in the #include directory list */
|
|
for (i = 0; i < nincdirs; ++i) {
|
|
/* don't include the file from two directories */
|
|
- sprintf(name, "%.*s/%s",
|
|
+ snprintf(name, sizeof(name), "%.*s/%s",
|
|
PATHLEN - 2 - file_len, incnames[i],
|
|
file);
|
|
if (infilelist(name) == YES) {
|
|
break;
|
|
}
|
|
/* make sure it exists and is readable */
|
|
- sprintf(path, "%.*s/%s",
|
|
+ snprintf(path, sizeof(path), "%.*s/%s",
|
|
PATHLEN - 2 - file_len, incdirs[i],
|
|
file);
|
|
if (access(compath(path), READ) == 0) {
|
|
@@ -659,7 +657,7 @@ inviewpath(char *file)
|
|
|
|
/* compute its path from higher view path source dirs */
|
|
for (i = 1; i < nvpsrcdirs; ++i) {
|
|
- sprintf(path, "%.*s/%s",
|
|
+ snprintf(path, sizeof(path), "%.*s/%s",
|
|
PATHLEN - 2 - file_len, srcdirs[i],
|
|
file);
|
|
if (access(compath(path), READ) == 0) {
|