Commit ebade23333d1f5c460aeb7f02473c96c95568a91

Patrick Steinhardt 2020-02-24T21:49:43

transports: auth_ntlm: fix use of strdup/strndup In the NTLM authentication code, we accidentally use strdup(3P) and strndup(3P) instead of our own wrappers git__strdup and git__strndup, respectively. Fix the issue by using our own functions.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/transports/auth_ntlm.c b/src/transports/auth_ntlm.c
index 02a861f..d134a3d 100644
--- a/src/transports/auth_ntlm.c
+++ b/src/transports/auth_ntlm.c
@@ -50,10 +50,10 @@ static int ntlm_set_credentials(http_auth_ntlm_context *ctx, git_credential *_cr
 	cred = (git_credential_userpass_plaintext *)_cred;
 
 	if ((sep = strchr(cred->username, '\\')) != NULL) {
-		domain = strndup(cred->username, (sep - cred->username));
+		domain = git__strndup(cred->username, (sep - cred->username));
 		GIT_ERROR_CHECK_ALLOC(domain);
 
-		domainuser = strdup(sep + 1);
+		domainuser = git__strdup(sep + 1);
 		GIT_ERROR_CHECK_ALLOC(domainuser);
 
 		username = domainuser;