Skip to contentSkip to conversation

osx-keychain: fix compiler warning

PATCH In review Lessley Dennington via GitGitGadget 4 participants 4 messages Jul 19, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 osx-keychain: fix compiler warning

From: Lessley Dennington <[email protected]>

Update git-credential-osxkeychain.c to remove 'format string is not a string literal (potentially insecure)' compiler warning by treating the string as an argument.

---
osx-keychain: fix compiler warning

Running make in contrib/credential/osxkeychain currently shows the following warning:

warning: format string is not a string literal (potentially insecure)

This small change to treat the string as an argument fixes the issue.

Thanks, Lessley

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1293%2Fldennington%2Ffix-osx-keychain-warning-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1293/ldennington/fix-osx-keychain-warning-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1293

 contrib/credential/osxkeychain/git-credential-osxkeychain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/credential/osxkeychain/git-credential-osxkeychain.c +1 -1
index 0b44a9b7cc6..bf77748d602 100644
@@ -168,7 +168,7 @@ int main(int argc, const char **argv)
 		"usage: git credential-osxkeychain <get|store|erase>";
 
 	if (!argv[1])
-		die(usage);
+		die("%s", usage);
 
 	read_credential();
 

base-commit: 71a8fab31b70c417e8f5b5f716581f89955a7082

Signature · 1 line
gitgitgadget
#1 lore raw

contrib/credential/osxkeychain/git-credential-osxkeychain.c int main(int argc, const char **argv) · line 171

Quoted 9 lines · Lessley Dennington via GitGitGadget

From: Lessley Dennington <[email protected]>

Update git-credential-osxkeychain.c to remove 'format string is not a string literal (potentially insecure)' compiler warning by treating the string as an argument.

contrib/credential/osxkeychain/git-credential-osxkeychain.c +1 -1
 	if (!argv[1])
-		die(usage);
+		die("%s", usage);

Thanks for preparing this for upstream. I reviewed this change as we were doing related things in the microsoft/git fork. LGTM here, too.

Thanks,
-Stolee

#2 lore raw
In reply to Lessley Dennington via GitGitGadget

"Lessley Dennington via GitGitGadget" <[email protected]>

Quoted 8 lines · writes:

From: Lessley Dennington <[email protected]>

Update git-credential-osxkeychain.c to remove 'format string is not a string literal (potentially insecure)' compiler warning by treating the string as an argument.

---

Perfect. Thanks. Will queue.

Quoted 11 lines
contrib/credential/osxkeychain/git-credential-osxkeychain.c +1 -1
@@ -168,7 +168,7 @@ int main(int argc, const char **argv)
 		"usage: git credential-osxkeychain <get|store|erase>";
 
 	if (!argv[1])
-		die(usage);
+		die("%s", usage);
 
 	read_credential();
 

base-commit: 71a8fab31b70c417e8f5b5f716581f89955a7082

#3 lore raw
In reply to Lessley Dennington via GitGitGadget
Quoted 10 lines · Lessley Dennington via GitGitGadget

From: Lessley Dennington <[email protected]>

Update git-credential-osxkeychain.c to remove 'format string is not a string literal (potentially insecure)' compiler warning by treating the string as an argument.

---
osx-keychain: fix compiler warning

Quoted 8 lines

Running make in contrib/credential/osxkeychain currently shows the following warning:

warning: format string is not a string literal (potentially insecure)

This small change to treat the string as an argument fixes the issue.

Thanks, Lessley

Thanks! I literally just ran into this warning, and it's been already fixed :)

Quoted 13 lines

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1293%2Fldennington%2Ffix-osx-keychain-warning-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1293/ldennington/fix-osx-keychain-warning-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1293

 contrib/credential/osxkeychain/git-credential-osxkeychain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/credential/osxkeychain/git-credential-osxkeychain.c +0 -0
index 0b44a9b7cc6..bf77748d602 100644

contrib/credential/osxkeychain/git-credential-osxkeychain.c int main(int argc, const char **argv) · line 173

Quoted 7 lines
contrib/credential/osxkeychain/git-credential-osxkeychain.c +1 -1
@@ -168,7 +168,7 @@ int main(int argc, const char **argv)
 		"usage: git credential-osxkeychain <get|store|erase>";
 
 	if (!argv[1])
-		die(usage);
+		die("%s", usage);
 
 	read_credential();

Looks good!

Quoted 5 lines

base-commit: 71a8fab31b70c417e8f5b5f716581f89955a7082

Signature · 1 line
gitgitgadget