Initialise 'psa' to NULL on every code path in the Pageant client
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 21 Jul 2013 11:01:22 +0000 (11:01 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 21 Jul 2013 11:01:22 +0000 (11:01 +0000)
code, fixing a potential segfault when compiling with -DNO_SECURITY.

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

windows/winpgntc.c

index de2b700..4074a16 100644 (file)
@@ -173,6 +173,7 @@ int agent_query(void *in, int inlen, void **out, int *outlen,
        return 1;                      /* *out == NULL, so failure */
     mapname = dupprintf("PageantRequest%08x", (unsigned)GetCurrentThreadId());
 
        return 1;                      /* *out == NULL, so failure */
     mapname = dupprintf("PageantRequest%08x", (unsigned)GetCurrentThreadId());
 
+    psa = NULL;
 #ifndef NO_SECURITY
     if (advapi_initialised || init_advapi()) {
         /*
 #ifndef NO_SECURITY
     if (advapi_initialised || init_advapi()) {
         /*
@@ -186,7 +187,6 @@ int agent_query(void *in, int inlen, void **out, int *outlen,
          */
         usersid = get_user_sid();
 
          */
         usersid = get_user_sid();
 
-        psa = NULL;
         if (usersid) {
             psd = (PSECURITY_DESCRIPTOR)
                 LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
         if (usersid) {
             psd = (PSECURITY_DESCRIPTOR)
                 LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);