From a5297cf7c36358be626614b3363cc68a4d05c4ac Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 16 May 2023 16:30:07 +0000 Subject: Some more nmakehlp.c tweaks --- win/nmakehlp.c | 9 ++++++--- 1 file 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; } -- cgit v0.12