From d6ea9ea18a4791e7b88763b12186a3e16758c30d Mon Sep 17 00:00:00 2001 From: david Date: Mon, 24 Aug 2009 20:57:32 +0000 Subject: [PATCH] Fix an array bound passed to GetModuleFileName. It should be the size of our static buffer, not 1024. --- nmap.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nmap.cc b/nmap.cc index e3543ec72..2ab5b4677 100644 --- a/nmap.cc +++ b/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--);