summaryrefslogtreecommitdiff
path: root/contrib/credential
diff options
context:
space:
mode:
authorBrandon Casey <drafnel@gmail.com>2013-09-23 18:49:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-10-16 16:35:31 (GMT)
commit73bbc0796b4ce65bfb1a12b47a0edc27845ecf50 (patch)
tree58672477c840a90eed386d58410bb125b1bd7e5d /contrib/credential
parentfb2763746f2a4dcd63a5e4b389f8308e775684d8 (diff)
downloadgit-73bbc0796b4ce65bfb1a12b47a0edc27845ecf50.zip
git-73bbc0796b4ce65bfb1a12b47a0edc27845ecf50.tar.gz
git-73bbc0796b4ce65bfb1a12b47a0edc27845ecf50.tar.bz2
contrib/git-credential-gnome-keyring.c: ensure buffer is non-empty before accessing
Ensure buffer length is non-zero before attempting to access the last element. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/credential')
-rw-r--r--contrib/credential/gnome-keyring/git-credential-gnome-keyring.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c b/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c
index b9bb794..0d2c55e 100644
--- a/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c
+++ b/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c
@@ -314,7 +314,7 @@ static int credential_read(struct credential *c)
{
line_len = strlen(buf);
- if (buf[line_len-1]=='\n')
+ if (line_len && buf[line_len-1] == '\n')
buf[--line_len]='\0';
if (!line_len)