mirror of
https://github.com/nmap/nmap.git
synced 2025-12-29 02:49:01 +00:00
Fix an array bound passed to GetModuleFileName. It should be the size of
our static buffer, not 1024.
This commit is contained in:
2
nmap.cc
2
nmap.cc
@@ -2842,7 +2842,7 @@ int nmap_fetchfile(char *filename_returned, int bufferlen, const char *file) {
|
||||
if (!foundsomething) { /* Try the nMap directory */
|
||||
char fnbuf[MAX_PATH];
|
||||
int i;
|
||||
res = GetModuleFileName(GetModuleHandle(0), fnbuf, 1024);
|
||||
res = GetModuleFileName(GetModuleHandle(0), fnbuf, sizeof(fnbuf));
|
||||
if(!res) fatal("GetModuleFileName failed (!)\n");
|
||||
/* Strip it */
|
||||
for(i = res - 1; i >= 0 && fnbuf[i] != '/' && fnbuf[i] != '\\'; i--);
|
||||
|
||||
Reference in New Issue
Block a user