| 34 | |
| 35 | |
| 36 | int |
| 37 | patch (struct sip_msg *msg, char *oldstr, unsigned int oldlen, char *newstr, |
| 38 | unsigned int newlen) |
| 39 | { |
| 40 | int off; |
| 41 | struct lump *anchor; |
| 42 | |
| 43 | if (oldstr == NULL) |
| 44 | return -1; |
| 45 | |
| 46 | if (newstr == NULL) |
| 47 | return -2; |
| 48 | off = oldstr - msg->buf; |
| 49 | if (off < 0) |
| 50 | return -3; |
| 51 | if ((anchor = del_lump (msg, off, oldlen, 0)) == 0) |
| 52 | { |
| 53 | LM_ERR("lumping with del_lump\n"); |
| 54 | return -4; |
| 55 | } |
| 56 | if ((insert_new_lump_after (anchor, newstr, newlen, 0)) == 0) |
| 57 | { |
| 58 | LM_ERR("lumping with insert_new_lump_after\n"); |
| 59 | return -5; |
| 60 | } |
| 61 | |
| 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | |
| 66 | /* TESTED */ |
no test coverage detected