diff --git a/daemon/sdp.c b/daemon/sdp.c index acb43e1a6..9d1bf5ad7 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -1382,6 +1382,9 @@ INLINE void chopper_append_str(struct sdp_chopper *c, const str *s) { static int copy_up_to_ptr(struct sdp_chopper *chop, const char *b) { int offset, len; + if (!b) + return 0; + offset = b - chop->input->s; assert(offset >= 0); assert(offset <= chop->input->len); @@ -1411,6 +1414,9 @@ static void copy_remainder(struct sdp_chopper *chop) { static int skip_over(struct sdp_chopper *chop, str *where) { int offset, len; + if (!where || !where->s) + return 0; + offset = (where->s - chop->input->s) + where->len; assert(offset >= 0); assert(offset <= chop->input->len);