[prev in list] [next in list] [prev in thread] [next in thread]
List: serdev
Subject: [sr-dev] Re: Fwd: git:master:5c90e6e2: DMQ: dmq_notification_address_list is initialized to NULL
From: Daniel-Constantin Mierla <miconda () gmail ! com>
Date: 2022-12-21 14:54:43
Message-ID: b4168450-da8b-bada-4059-09ba204e5d6a () gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
[Attachment #4 (text/plain)]
It is unlikely that this patch solves any eventual issues that you had.
You changed the comparison of a pointer with NULL to 0 and, in C, NULL
and 0 are the same in context of pointers:
- https://c-faq.com/null/nullor0.html
So practically there is not change in behaviour.
Cheers,
Daniel
On 21.12.22 15:41, Olle E. Johansson wrote:
> I suggest that this patch be backported :-)
>
> Cheers,
> /O
>
>> Begin forwarded message:
>>
>> *From: *Olle E. Johansson <oej@edvina.net>
>> *Subject: **[sr-dev] git:master:5c90e6e2: DMQ:
>> dmq_notification_address_list is initialized to NULL*
>> *Date: *21 December 2022 at 15:27:49 CET
>> *To: *sr-dev@lists.kamailio.org
>> *Reply-To: *"Kamailio (SER) - Development Mailing List"
>> <sr-dev@lists.kamailio.org>
>>
>> Module: kamailio
>> Branch: master
>> Commit: 5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb
>> URL:
>> https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb
>>
>> Author: Olle E. Johansson <oej@edvina.net>
>> Committer: Olle E. Johansson <oej@edvina.net>
>> Date: 2022-12-21T15:27:28+01:00
>>
>> DMQ: dmq_notification_address_list is initialized to NULL
>>
>> This code led to random and unpredictable behaviour when loading a
>> configuration with
>> multiple notification nodes.
>>
>> ---
>>
>> Modified: src/modules/dmq/dmq.c
>>
>> ---
>>
>> Diff:
>> https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.diff
>> Patch:
>> https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.patch
>>
>> ---
>>
>> diff --git a/src/modules/dmq/dmq.c b/src/modules/dmq/dmq.c
>> index 843b7e3e4d2..f4a66c3d847 100644
>> --- a/src/modules/dmq/dmq.c
>> +++ b/src/modules/dmq/dmq.c
>> @@ -379,7 +379,7 @@ static int
>> dmq_add_notification_address(modparam_t type, void * val)
>> }
>>
>> /* initial allocation */
>> -if (dmq_notification_address_list == 0) {
>> +if (dmq_notification_address_list == NULL) {
>> dmq_notification_address_list = pkg_malloc(sizeof(str_list_t));
>> if (dmq_notification_address_list == NULL) {
>> PKG_MEM_ERROR;
>>
>> _______________________________________________
>> Kamailio (SER) - Development Mailing List
>> To unsubscribe send an email to sr-dev-leave@lists.kamailio.org
>
--
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
[Attachment #5 (text/html)]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">It is unlikely that this patch solves
any eventual issues that you had.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">You changed the comparison of a pointer
with NULL to 0 and, in C, NULL and 0 are the same in context of
pointers:</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix"> - <a class="moz-txt-link-freetext" \
href="https://c-faq.com/null/nullor0.html">https://c-faq.com/null/nullor0.html</a></div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">So practically there is not change in
behaviour.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Cheers,<br>
Daniel<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">On 21.12.22 15:41, Olle E. Johansson
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:46FF1674-DD9C-417B-B81B-9637CB0A3E5F@edvina.net">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
I suggest that this patch be backported :-)
<div class=""><br class="">
</div>
<div class="">Cheers,</div>
<div class="">/O<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">Begin forwarded message:</div>
<br class="Apple-interchange-newline">
<div style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px;" class=""><span
style="font-family: -webkit-system-font, Helvetica Neue,
Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);"
class=""><b class="">From: </b></span><span
style="font-family: -webkit-system-font, Helvetica Neue,
Helvetica, sans-serif;" class="">Olle E. Johansson <<a
href="mailto:oej@edvina.net"
class="moz-txt-link-freetext" \
moz-do-not-send="true">oej@edvina.net</a>><br class="">
</span></div>
<div style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px;" class=""><span
style="font-family: -webkit-system-font, Helvetica Neue,
Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);"
class=""><b class="">Subject: </b></span><span
style="font-family: -webkit-system-font, Helvetica Neue,
Helvetica, sans-serif;" class=""><b class="">[sr-dev]
<a class="moz-txt-link-freetext" \
href="git:master:5c90e6e2">git:master:5c90e6e2</a>: DMQ:
dmq_notification_address_list is initialized to NULL</b><br
class="">
</span></div>
<div style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px;" class=""><span
style="font-family: -webkit-system-font, Helvetica Neue,
Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);"
class=""><b class="">Date: </b></span><span
style="font-family: -webkit-system-font, Helvetica Neue,
Helvetica, sans-serif;" class="">21 December 2022 at
15:27:49 CET<br class="">
</span></div>
<div style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px;" class=""><span
style="font-family: -webkit-system-font, Helvetica Neue,
Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);"
class=""><b class="">To: </b></span><span
style="font-family: -webkit-system-font, Helvetica Neue,
Helvetica, sans-serif;" class=""><a
href="mailto:sr-dev@lists.kamailio.org"
class="moz-txt-link-freetext" \
moz-do-not-send="true">sr-dev@lists.kamailio.org</a><br class="">
</span></div>
<div style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px;" class=""><span
style="font-family: -webkit-system-font, Helvetica Neue,
Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);"
class=""><b class="">Reply-To: </b></span><span
style="font-family: -webkit-system-font, Helvetica Neue,
Helvetica, sans-serif;" class="">"Kamailio (SER) -
Development Mailing List" <<a
href="mailto:sr-dev@lists.kamailio.org"
class="moz-txt-link-freetext" \
moz-do-not-send="true">sr-dev@lists.kamailio.org</a>><br class="">
</span></div>
<br class="">
<div class="">
<div class="">Module: kamailio<br class="">
Branch: master<br class="">
Commit: 5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb<br
class="">
URL: <a
href="https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb"
class="moz-txt-link-freetext" \
moz-do-not-send="true">https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb</a><br
class="">
<br class="">
Author: Olle E. Johansson <<a
href="mailto:oej@edvina.net"
class="moz-txt-link-freetext" \
moz-do-not-send="true">oej@edvina.net</a>><br class="">
Committer: Olle E. Johansson <<a
href="mailto:oej@edvina.net"
class="moz-txt-link-freetext" \
moz-do-not-send="true">oej@edvina.net</a>><br class="">
Date: 2022-12-21T15:27:28+01:00<br class="">
<br class="">
DMQ: dmq_notification_address_list is initialized to
NULL<br class="">
<br class="">
This code led to random and unpredictable behaviour when
loading a configuration with<br class="">
multiple notification nodes.<br class="">
<br class="">
---<br class="">
<br class="">
Modified: src/modules/dmq/dmq.c<br class="">
<br class="">
---<br class="">
<br class="">
Diff: <a
href="https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.diff"
class="moz-txt-link-freetext" \
moz-do-not-send="true">https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.diff</a><br
class="">
Patch: <a
href="https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.patch"
class="moz-txt-link-freetext" \
moz-do-not-send="true">https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.patch</a><br
class="">
<br class="">
---<br class="">
<br class="">
diff --git a/src/modules/dmq/dmq.c
b/src/modules/dmq/dmq.c<br class="">
index 843b7e3e4d2..f4a66c3d847 100644<br class="">
--- a/src/modules/dmq/dmq.c<br class="">
+++ b/src/modules/dmq/dmq.c<br class="">
@@ -379,7 +379,7 @@ static int
dmq_add_notification_address(modparam_t type, void *
val)<br class="">
<span class="Apple-tab-span" style="white-space:pre"> </span>}<br
class="">
<br class="">
<span class="Apple-tab-span" style="white-space:pre"> </span>/*
initial allocation */<br class="">
-<span class="Apple-tab-span" style="white-space:pre"> </span>if
(dmq_notification_address_list == 0) {<br class="">
+<span class="Apple-tab-span" style="white-space:pre"> </span>if
(dmq_notification_address_list == NULL) {<br class="">
<span class="Apple-tab-span" style="white-space:pre"> </span><span \
class="Apple-tab-span" style="white-space:pre"> </span>dmq_notification_address_list \
= pkg_malloc(sizeof(str_list_t));<br class="">
<span class="Apple-tab-span" style="white-space:pre"> </span><span \
class="Apple-tab-span" style="white-space:pre"> </span>if \
(dmq_notification_address_list == NULL) {<br class=""> <span class="Apple-tab-span" \
style="white-space:pre"> </span><span class="Apple-tab-span" \
style="white-space:pre"> </span><span class="Apple-tab-span" \
style="white-space:pre"> </span>PKG_MEM_ERROR;<br class="">
<br class="">
_______________________________________________<br
class="">
Kamailio (SER) - Development Mailing List<br class="">
To unsubscribe send an email to <a
href="mailto:sr-dev-leave@lists.kamailio.org"
class="moz-txt-link-freetext" \
moz-do-not-send="true">sr-dev-leave@lists.kamailio.org</a><br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</blockquote>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" \
href="http://www.asipto.com">www.asipto.com</a> <a class="moz-txt-link-abbreviated" \
href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a \
class="moz-txt-link-abbreviated" \
href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a></pre> \
</body> </html>
_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-leave@lists.kamailio.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic