# [PATCH] osx-keychain: fix compiler warning

4 messages from 2022-07-19 to 2022-07-19. Participants: Lessley Dennington via GitGitGadget, Derrick Stolee, Junio C Hamano, Glen Choo.
Thread: https://gitlist.dev/t/58189

## Lessley Dennington via GitGitGadget, 2022-07-19 17:25

Subject: [PATCH] osx-keychain: fix compiler warning
Message-ID: <pull.1293.git.1658251503775.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.1293.git.1658251503775.gitgitgadget%40gmail.com

```
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(-)

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, 2022-07-19 17:30

Subject: Re: [PATCH] osx-keychain: fix compiler warning
Message-ID: <19ab5c2b-6506-18c1-b8c1-b96074442edf@github.com>
URL: https://gitlist.dev/e/19ab5c2b-6506-18c1-b8c1-b96074442edf%40github.com
In-Reply-To: <pull.1293.git.1658251503775.gitgitgadget@gmail.com>

```
On 7/19/2022 1:25 PM, Lessley Dennington via GitGitGadget wrote:
> 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, 2022-07-19 18:24

Subject: Re: [PATCH] osx-keychain: fix compiler warning
Message-ID: <xmqq8roparkd.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqq8roparkd.fsf%40gitster.g
In-Reply-To: <pull.1293.git.1658251503775.gitgitgadget@gmail.com>

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

> 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.

> @@ -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, 2022-07-19 18:29

Subject: Re: [PATCH] osx-keychain: fix compiler warning
Message-ID: <kl6llespt0qn.fsf@chooglen-macbookpro.roam.corp.google.com>
URL: https://gitlist.dev/e/kl6llespt0qn.fsf%40chooglen-macbookpro.roam.corp.google.com
In-Reply-To: <pull.1293.git.1658251503775.gitgitgadget@gmail.com>

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

> 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 :)

>
> 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!

>  
>
> base-commit: 71a8fab31b70c417e8f5b5f716581f89955a7082
> -- 
> gitgitgadget

```
