Summary:ASTERISK-04444: [patch] fix infinite loop in chan sip introduced from M4447
Reporter:Luigi Rizzo (rizzo)Labels:
Date Opened:2005-06-20 11:13:58Date Closed:2005-06-20 13:00:42
Versions:Frequency of
Environment:Attachments:( 0) chan_sip.diff
Description:my previous patch ASTERISK-4335 erroneously deleted a couple of lines near
the end of the outer loop in function reply_digest(), which causes the
function to go into an infinite loop in some cases.
The attached patch fixes the problem and takes the chance to introduce
a function skip_sep() which locates a separator char, changes it to '\0'
and returns a pointer to the next char (or NULL if not found).
Hopefully this should prevent similar cut&paste errors in the future.

In fact, he function could be used in probably a hundred places across
the code, but let's fix this particular bug now.
Should it be considered generally useful, move skip_sep() to utils.h
and rename it to ast_skip_sep() or something similar.


1. my apologies for the bug. no cookies for the fix :)
2. i don't particularly like the use of inline functions but since someone
here likes it let's stick to the prevailing fashion... :)
Comments:By: Kevin P. Fleming (kpfleming) 2005-06-20 12:54:57

Your skip_sep function does almost the same thing as strsep(). In fact, the syntax

c = skip_sep(c, ',');

could easily be:

strsep(&c, ",");

I'll address this in your patch and get it committed.

By: Kevin P. Fleming (kpfleming) 2005-06-20 13:00:32

Committed to CVS HEAD, using strsep() instead of new function.