Protect against a (non-security-related) buffer overrun if PuTTY is
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 21 Dec 2010 10:11:32 +0000 (10:11 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 21 Dec 2010 10:11:32 +0000 (10:11 +0000)
installed somewhere with an exceptionally long pathname.

git-svn-id: svn://svn.tartarus.org/sgt/putty@9039 cda61777-01e9-0310-a592-d414129be87e

windows/winpgnt.c

index d592a5e..3451fec 100644 (file)
@@ -2003,7 +2003,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
     {
         char b[2048], *p, *q, *r;
         FILE *fp;
-        GetModuleFileName(NULL, b, sizeof(b) - 1);
+        GetModuleFileName(NULL, b, sizeof(b) - 16);
         r = b;
         p = strrchr(b, '\\');
         if (p && p >= r) r = p+1;