auth/credentials: Add talloc NULL check in cli_credentials_set_principal()
authorAndreas Schneider <asn@samba.org>
Thu, 6 Oct 2016 06:16:57 +0000 (08:16 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 20 Dec 2016 12:52:09 +0000 (13:52 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
auth/credentials/credentials.c

index 9a935c6cf39b6ec13adaa9e1094b6528990d4ca7..06648c7f99810450afe691a88761f9d1fe9562e7 100644 (file)
@@ -268,7 +268,11 @@ _PUBLIC_ bool cli_credentials_set_principal(struct cli_credentials *cred,
 {
        if (obtained >= cred->principal_obtained) {
                cred->principal = talloc_strdup(cred, val);
+               if (cred->principal == NULL) {
+                       return false;
+               }
                cred->principal_obtained = obtained;
+
                cli_credentials_invalidate_ccache(cred, cred->principal_obtained);
                return true;
        }