On Friday 12 October 2007, Juha Heinanen wrote: > this morning i noticed a crash in lcr module. i had added a permanent > usrloc contact using ul_add mi function. as result, i got into location > table an entry where socket field had NULL value. > > one of things that lcr load_contacts function does is encoding of branch > info into a string that contains among other things socket value. it > does socket to string conversion by calling socket_info.h function > socket2str like this: > > if (!socket2str(con->sock, at, &len)) { > LM_ERR("Failed to convert socket to str\n"); > return 0; > } > > now if con->sock is null (0), the above socket2str call crashes > openser. > > i could, of course, add a con->sock null test in lcr module before > calling socket2str, but i feel that a more proper place for the test > would be in socket2str function, because socket can be null and the > function should thus be able to handle also such sockets.
Hi Juha, you're right, there should be a test in socket2str. If the socket is null, we should return -1 and log a Error, like in the other datatype conversion functions. Cheers, Henning _______________________________________________ Devel mailing list Devel@openser.org http://openser.org/cgi-bin/mailman/listinfo/devel