All pastes #193894 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-10-07 09:57 UTC
rendered paste body

/*! \brief  get_msg_text: Get text out of a SIP MESSAGE packet ---*/
static int get_msg_text(char *buf, int len, struct sip_request *req)
{
        int x;
        int y;

        buf[0] = '\0';
        y = len - strlen(buf) - 5;
        if (y < 0)
                y = 0;
        for (x=0;x<req->lines;x++) {
                strncat(buf, req->line[x], y); /* safe */
                y -= strlen(req->line[x]) + 1;
                if (y < 0)
                        y = 0;
                if (y != 0)
                        strcat(buf, "\n"); /* safe */
        }
        return 0;
}