threads / patch / 58189

patchosx-keychain: fix compiler warning

Subject: [PATCH] osx-keychain: fix compiler warning

## tl;dr

4 messages between Jul 19, 2022 and Jul 19, 2022. Diffs are folded; open one to read it.

replies: 3people: 4as markdown or json

Lessley Dennington via GitGitGadget· Jul 19, 2022, 17:25 UTC · lore
From: Lessley Dennington <lessleydennington@gmail.com>

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.

Signed-off-by: Lessley Dennington <lessleydennington@gmail.com>
---
    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(-)
Show changes to contrib/credential/osxkeychain/git-credential-osxkeychain.c +1 −1
diff --git a/contrib/credential/osxkeychain/git-credential-osxkeychain.c b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
index 0b44a9b7cc6..bf77748d602 100644
--- a/contrib/credential/osxkeychain/git-credential-osxkeychain.c
+++ b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
@@ -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
-- 
gitgitgadget
Derrick Stolee· Jul 19, 2022, 17:30 UTC · re: Lessley Dennington via GitGitGadget · lore

Re: [PATCH] osx-keychain: fix compiler warning

On 7/19/2022 1:25 PM, Lessley Dennington via GitGitGadget wrote:
Show 5 quoted lines
> From: Lessley Dennington <lessleydennington@gmail.com>
> 
> 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.
>  	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

Junio C Hamano· Jul 19, 2022, 18:24 UTC · re: Lessley Dennington via GitGitGadget · lore

Re: [PATCH] osx-keychain: fix compiler warning

"Lessley Dennington via GitGitGadget" <gitgitgadget@gmail.com> writes:

Show 8 quoted lines
> From: Lessley Dennington <lessleydennington@gmail.com>
>
> 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.
>
> Signed-off-by: Lessley Dennington <lessleydennington@gmail.com>
> ---
Perfect.  Thanks.  Will queue.
Show 11 quoted lines
> @@ -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
Glen Choo· Jul 19, 2022, 18:29 UTC · re: Lessley Dennington via GitGitGadget · lore

Re: [PATCH] osx-keychain: fix compiler warning

"Lessley Dennington via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 18 quoted lines
> From: Lessley Dennington <lessleydennington@gmail.com>
>
> 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.
>
> Signed-off-by: Lessley Dennington <lessleydennington@gmail.com>
> ---
>     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

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

Show 20 quoted 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(-)
>
> diff --git a/contrib/credential/osxkeychain/git-credential-osxkeychain.c b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
> index 0b44a9b7cc6..bf77748d602 100644
> --- a/contrib/credential/osxkeychain/git-credential-osxkeychain.c
> +++ b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
> @@ -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!
Show 5 quoted lines
>  
>
> base-commit: 71a8fab31b70c417e8f5b5f716581f89955a7082
> -- 
> gitgitgadget

← back to recent threads