Summary:ASTERISK-01956: chan_h323 error (maybe human? ;) )
Reporter:Konstantin Prokazoff (oryx)Labels:
Date Opened:2004-07-06 12:19:05Date Closed:2004-09-25 02:37:50
Versions:Frequency of
Description:@@ -862,7 +862,7
strtok_r(host, "/", &(h323id));
-if(*h323id) {
+if(h323id) {


Coredump 100%, while dialouting by h.323.
Comments:By: Konstantin Prokazoff (oryx) 2004-07-07 03:08:19

Sorry, due to logic, I think must be:
+if(!h323id) {
or +if(h323id) ???

edited on: 07-07-04 02:55

By: Mark Spencer (markster) 2004-07-07 08:40:08


if (h323id && *h323id) {

is the right answer.

By: twisted (twisted) 2004-07-08 08:48:22

Does this in any way relate to ASTERISK-1326?

By: Konstantin Prokazoff (oryx) 2004-07-08 09:04:20

Yes, because in some cases, asterisk chan_h323 tries to resolve value by pointer h323id, which are NULL. Taking a coredump with Segmentation Fault.

By: zoa (zoa) 2004-07-08 09:44:16

could someone try to make a little patch.diff based on marksters suggestion ?

I'll be happy to try it right away.


By: Konstantin Prokazoff (oryx) 2004-07-08 09:55:35

I think, marksters suggestion isn't good idea. Maybe Jeremy will say something, but IMHO is:
if(h323id) if(*h323id) {
w'be more efficiently, so (different) compilers w'lln't try to resolve *, if pointer are NULL.

By: Mark Spencer (markster) 2004-07-08 10:31:03

If you say:

if (c && *c) {

it's always safe against null because of c is null, then it will not continue to execute the && because it already found a 0.

similarly if you do:

if (a() || b()) {

the compiler will execute b() only if a() returns 0.

By: Konstantin Prokazoff (oryx) 2004-07-08 12:53:11

Mark, I don't wanna to be a "master hacker", but it seems to be done by some compilers, like ibm c++ set (so on), to resolve "if" block from right to left equation. So, if it resolve first *c, it will generate SegFault. We have working with asterisk hardly more than 3 months, we have our own call center with more than min. 10k+ calls/day (for Ukraine, this not very bad ;)) under platforms mix, and we w'll be glad to take practise, and I suppose very resultative role in asterisk life, if you'll take us to your's beta-testers and "representative-in-Ukraine" mission.

By: jerjer (jerjer) 2004-07-09 05:09:41

Fixed in cvs -head.