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>maint
parent
fb2763746f
commit
73bbc0796b
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue