git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Augie Fackler <durin42@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Alex Riesen <raa.lkml@gmail.com>,
	git@vger.kernel.org, Benjamin Kramer <benny.kra@googlemail.com>,
	Jon Loeliger <jdl@jdl.com>
Subject: Re: [PATCH] Don't crash if ai_canonname comes back as null
Date: Wed, 29 Apr 2009 18:32:02 -0500	[thread overview]
Message-ID: <A85E96CC-CF0B-40F9-9960-00485285E6ED@gmail.com> (raw)
In-Reply-To: <7v63gn59mw.fsf@gitster.siamese.dyndns.org>


On Apr 29, 2009, at 6:21 PM, Junio C Hamano wrote:

> Augie Fackler <durin42@gmail.com> writes:
>
>> Fixes a weird bug where git-daemon was segfaulting
>> when started by sh(1) because ai_canonname was null.
>> ---
>> Fixed based on feedback.
>
> Hmm.
>
> I've been waiting for feedback to a patch proposed earlier in the same
> area, which is <49F5BA55.3060606@googlemail.com> ($gmane/117670).  How
> does this new one relate to it?

I can't comment much on the correctness of the code - my patch was the  
minimal change to have it not crash.

The other patch also works for me to prevent the crash, and looks like  
it might be a little more correct in terms of having a meaningful  
hostname.

>> daemon.c |    2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/daemon.c b/daemon.c
>> index 13401f1..ae21d92 100644
>> --- a/daemon.c
>> +++ b/daemon.c
>> @@ -459,7 +459,7 @@ static void parse_extra_args(char *extra_args,  
>> int
>> buflen)
>> 				inet_ntop(AF_INET, &sin_addr->sin_addr,
>> 					  addrbuf, sizeof(addrbuf));
>> 				free(canon_hostname);
>> -				canon_hostname = xstrdup(ai->ai_canonname);
>> +				canon_hostname = ai->ai_canonname ?
>> xstrdup(ai->ai_canonname) : NULL;
>> 				free(ip_address);
>> 				ip_address = xstrdup(addrbuf);
>> 				break;
>> --
>> 1.6.2.GIT
>

  reply	other threads:[~2009-04-29 23:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-29 21:48 [PATCH] Workaround for ai_canonname sometimes coming back as null Augie Fackler
2009-04-29 21:55 ` Alex Riesen
2009-04-29 21:56   ` Augie Fackler
2009-04-29 22:01     ` Alex Riesen
2009-04-29 22:04     ` Alex Riesen
2009-04-29 23:04       ` [PATCH] Don't crash if ai_canonname comes " Augie Fackler
2009-04-29 23:21         ` Junio C Hamano
2009-04-29 23:32           ` Augie Fackler [this message]
2009-04-30 14:13             ` Jon Loeliger
2009-04-30 16:57               ` Junio C Hamano
2009-04-29 21:56   ` [PATCH] Workaround for ai_canonname sometimes coming " Alex Riesen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A85E96CC-CF0B-40F9-9960-00485285E6ED@gmail.com \
    --to=durin42@gmail.com \
    --cc=benny.kra@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jdl@jdl.com \
    --cc=raa.lkml@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).