summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/nmakehlp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/win/nmakehlp.c b/win/nmakehlp.c
index 4d95662..c8b39a7 100644
--- a/win/nmakehlp.c
+++ b/win/nmakehlp.c
@@ -727,11 +727,13 @@ static int LocateDependencyHelper(const char *dir, const char *keypath)
int keylen, ret;
WIN32_FIND_DATA finfo;
- if (dir == NULL || keypath == NULL)
+ if (dir == NULL || keypath == NULL) {
return 2; /* Have no real error reporting mechanism into nmake */
+ }
dirlen = strlen(dir);
- if ((dirlen + 3) > sizeof(path))
+ if (dirlen > sizeof(path) - 3) {
return 2;
+ }
strncpy(path, dir, dirlen);
strncpy(path+dirlen, "\\*", 3); /* Including terminating \0 */
keylen = strlen(keypath);
@@ -797,8 +799,9 @@ static int LocateDependency(const char *keypath)
for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) {
ret = LocateDependencyHelper(paths[i], keypath);
- if (ret == 0)
+ if (ret == 0) {
return ret;
+ }
}
return ret;
}