Re: [Dnsmasq-discuss] dnsmasqd crash

2017-06-27 Thread Justin Jose
Hi Simon.

The issue is reproducible on my device. It is very difficult for me to upgrade 
the current version to the latest.

But after close investigation I found a bug in our code and the issue is 
resolved now. Basically domain in the 'forward_query' function should
always point to the current server's domain. 

Thanks
Justin

From: Dnsmasq-discuss  on 
behalf of Simon Kelley 
Sent: Monday, 26 June 2017 8:49 a.m.
To: dnsmasq-discuss@lists.thekelleys.org.uk
Subject: Re: [Dnsmasq-discuss] dnsmasqd crash

Can you reproduce the crash? What triggers it?

2.55 is seven years old now, and predates our use of git, so it's pretty
difficult to point to a fix, but I suspect that this bug is long gone.
Finding how to reproduce it and showing that it doesn't happen with
newer releases would be the best way.




Cheers,

Simon.

On 20/06/17 22:44, Justin Jose wrote:
> Hi Kevin,
>
> Thank you for the response. Here are my answers for your questions.
>
> Q. What version of dnsmasq?
>
> [Ans] The dnsmasq version I am using is 2.55.
>
> Q. hostname_isequal is used in quite a few places and should never be
> passed a null pointer, so in my opinion the fix is a sticking plaster
> over the issue and has the potential result of leaving null pointers
> hanging around for other functions to fall over anyway.  The root cause
> should be found and squished.  Any idea which particular call to
> hostname_isequal was involved?
>
> [Ans:] When the crash happened, the call to hostname_isequal is occured from 
> forward_query at round line number 500.
>I am not sure the reason for the NULL arguments here.
>
> Regards
> Justin
> 
> From: Dnsmasq-discuss  on 
> behalf of Kevin Darbyshire-Bryant 
> Sent: Monday, 19 June 2017 8:56 p.m.
> To: dnsmasq-discuss@lists.thekelleys.org.uk
> Subject: Re: [Dnsmasq-discuss] dnsmasqd crash
>
> On 19/06/17 01:02, Justin Jose wrote:
>> ​​​Hi,
>>
>>
>> I got a couple of dnsmasqd crash and on investigating I found the crash
>> is due to accessing a NULL pointer.
>
> What version of dnsmasq?
>
>>
>> I have a fix for this problem and attached with this mail.
>>
>>
>> Would you have any suggestion for this fix?
>
> hostname_isequal is used in quite a few places and should never be
> passed a null pointer, so in my opinion the fix is a sticking plaster
> over the issue and has the potential result of leaving null pointers
> hanging around for other functions to fall over anyway.  The root cause
> should be found and squished.  Any idea which particular call to
> hostname_isequal was involved?
>
> Cheers,
>
> Kevin
>
> ___
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> ___
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>


___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] dnsmasqd crash

2017-06-25 Thread Simon Kelley
Can you reproduce the crash? What triggers it?

2.55 is seven years old now, and predates our use of git, so it's pretty
difficult to point to a fix, but I suspect that this bug is long gone.
Finding how to reproduce it and showing that it doesn't happen with
newer releases would be the best way.




Cheers,

Simon.

On 20/06/17 22:44, Justin Jose wrote:
> Hi Kevin,
> 
> Thank you for the response. Here are my answers for your questions.
> 
> Q. What version of dnsmasq?
> 
> [Ans] The dnsmasq version I am using is 2.55.
> 
> Q. hostname_isequal is used in quite a few places and should never be
> passed a null pointer, so in my opinion the fix is a sticking plaster
> over the issue and has the potential result of leaving null pointers
> hanging around for other functions to fall over anyway.  The root cause
> should be found and squished.  Any idea which particular call to
> hostname_isequal was involved?
> 
> [Ans:] When the crash happened, the call to hostname_isequal is occured from 
> forward_query at round line number 500.
>I am not sure the reason for the NULL arguments here. 
> 
> Regards
> Justin
> 
> From: Dnsmasq-discuss  on 
> behalf of Kevin Darbyshire-Bryant 
> Sent: Monday, 19 June 2017 8:56 p.m.
> To: dnsmasq-discuss@lists.thekelleys.org.uk
> Subject: Re: [Dnsmasq-discuss] dnsmasqd crash
> 
> On 19/06/17 01:02, Justin Jose wrote:
>> ​​​Hi,
>>
>>
>> I got a couple of dnsmasqd crash and on investigating I found the crash
>> is due to accessing a NULL pointer.
> 
> What version of dnsmasq?
> 
>>
>> I have a fix for this problem and attached with this mail.
>>
>>
>> Would you have any suggestion for this fix?
> 
> hostname_isequal is used in quite a few places and should never be
> passed a null pointer, so in my opinion the fix is a sticking plaster
> over the issue and has the potential result of leaving null pointers
> hanging around for other functions to fall over anyway.  The root cause
> should be found and squished.  Any idea which particular call to
> hostname_isequal was involved?
> 
> Cheers,
> 
> Kevin
> 
> ___
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> ___
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 


___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] dnsmasqd crash

2017-06-20 Thread Justin Jose
Hi Kevin,

Thank you for the response. Here are my answers for your questions.

Q. What version of dnsmasq?

[Ans] The dnsmasq version I am using is 2.55.

Q. hostname_isequal is used in quite a few places and should never be
passed a null pointer, so in my opinion the fix is a sticking plaster
over the issue and has the potential result of leaving null pointers
hanging around for other functions to fall over anyway.  The root cause
should be found and squished.  Any idea which particular call to
hostname_isequal was involved?

[Ans:] When the crash happened, the call to hostname_isequal is occured from 
forward_query at round line number 500.
   I am not sure the reason for the NULL arguments here. 

Regards
Justin

From: Dnsmasq-discuss  on 
behalf of Kevin Darbyshire-Bryant 
Sent: Monday, 19 June 2017 8:56 p.m.
To: dnsmasq-discuss@lists.thekelleys.org.uk
Subject: Re: [Dnsmasq-discuss] dnsmasqd crash

On 19/06/17 01:02, Justin Jose wrote:
> ​​​Hi,
>
>
> I got a couple of dnsmasqd crash and on investigating I found the crash
> is due to accessing a NULL pointer.

What version of dnsmasq?

>
> I have a fix for this problem and attached with this mail.
>
>
> Would you have any suggestion for this fix?

hostname_isequal is used in quite a few places and should never be
passed a null pointer, so in my opinion the fix is a sticking plaster
over the issue and has the potential result of leaving null pointers
hanging around for other functions to fall over anyway.  The root cause
should be found and squished.  Any idea which particular call to
hostname_isequal was involved?

Cheers,

Kevin

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] dnsmasqd crash

2017-06-20 Thread Kevin Darbyshire-Bryant
Probably best to reply to the list as well where there are much better 
experts than me.


On 19/06/17 22:39, Justin Jose wrote:

Hi Kevin,

Thank you for the response. Here are my answers for your questions.

Q. What version of dnsmasq?

[Ans] The dnsmasq version I am using is 2.55.


2.55 is some 7 years old, 2.77 being released 2 weeks or so ago and 2.78 
fixing a couple of oversights in that release due 'soon'.




Q. hostname_isequal is used in quite a few places and should never be
passed a null pointer, so in my opinion the fix is a sticking plaster
over the issue and has the potential result of leaving null pointers
hanging around for other functions to fall over anyway.  The root cause
should be found and squished.  Any idea which particular call to
hostname_isequal was involved?

[Ans:] When the crash happened, the call to hostname_isequal is occured from 
forward_query at round line number 500.
I am not sure the reason for the NULL arguments here.


The first step here has to be to update to a much more recent version of 
dnsmasq and see if the problem still occurs.  Is the error repeatable? 
If so, that would make testing a lot easier.


Cheers,

Kevin

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] dnsmasqd crash

2017-06-19 Thread Kevin Darbyshire-Bryant



On 19/06/17 01:02, Justin Jose wrote:

​​​Hi,


I got a couple of dnsmasqd crash and on investigating I found the crash 
is due to accessing a NULL pointer.


What version of dnsmasq?



I have a fix for this problem and attached with this mail.


Would you have any suggestion for this fix?


hostname_isequal is used in quite a few places and should never be 
passed a null pointer, so in my opinion the fix is a sticking plaster 
over the issue and has the potential result of leaving null pointers 
hanging around for other functions to fall over anyway.  The root cause 
should be found and squished.  Any idea which particular call to 
hostname_isequal was involved?


Cheers,

Kevin

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


[Dnsmasq-discuss] dnsmasqd crash

2017-06-18 Thread Justin Jose
???Hi,


I got a couple of dnsmasqd crash and on investigating I found the crash is due 
to accessing a NULL pointer.

I have a fix for this problem and attached with this mail.


Would you have any suggestion for this fix?


Thanks

Justin

CR-57199: Fix dnsmasqd crash

From: Justin Jose 

The crash is caused by accessing NULL pointer in hostname_isequal().
If any string is NULL return "not equal" without string comparison.

---
 src/util.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util.c b/src/util.c
index 6b193b7..b41d814 100644
--- a/src/util.c
+++ b/src/util.c
@@ -286,6 +286,9 @@ int hostname_isequal(char *a, char *b)
 {
   unsigned int c1, c2;
   
+  if (a == NULL || b == NULL)
+return 0;
+  
   do {
 c1 = (unsigned char) *a++;
 c2 = (unsigned char) *b++;
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss