cifs-utils: don't return uninitialized value in cifs_gss_get_req
authoratheik <atteh.mailbox@gmail.com>
Sat, 30 Apr 2022 21:48:26 +0000 (00:48 +0300)
committerPavel Shilovsky <piastryyy@gmail.com>
Mon, 13 Jun 2022 17:45:18 +0000 (10:45 -0700)
If the first malloc fails, maj_stat is uninitialized and used as
the return value through the GSS_ERROR() macro. Use GSS_S_FAILURE to
indicate a miscellaneous error.

Signed-off-by: atheik <atteh.mailbox@gmail.com>
cifs.upcall.c

index 922d644ceff336a13c3fc80c86ab00ca9f1b71ac..52c03280dbe0704c9aa617c24d0dbdba279fbb06 100644 (file)
@@ -795,6 +795,7 @@ cifs_gss_get_req(const char *host, DATA_BLOB *mechtoken, DATA_BLOB *sess_key)
        char *service_name = malloc(service_name_len);
        if (!service_name) {
                syslog(LOG_DEBUG, "out of memory allocating service name");
+               maj_stat = GSS_S_FAILURE;
                goto out;
        }