MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / bin_skip_str

Function bin_skip_str

bin_interface.c:294–318  ·  view source on GitHub ↗

* skips @count strings from the current position in a received binary packet * * @return: * 0: success * < 0: error, buffer limit reached */

Source from the content-addressed store, hash-verified

292 * < 0: error, buffer limit reached
293 */
294int bin_skip_str(bin_packet_t *packet, int count)
295{
296 int i, len;
297
298 for (i = 0; i < count; i++) {
299 if (packet->front_pointer - packet->buffer.s + LEN_FIELD_SIZE >
300 packet->buffer.len)
301 goto error;
302
303 len = 0;
304 memcpy(&len, packet->front_pointer, LEN_FIELD_SIZE);
305 packet->front_pointer += LEN_FIELD_SIZE;
306
307 if (packet->front_pointer - packet->buffer.s + len > packet->buffer.len)
308 goto error;
309
310 packet->front_pointer += len;
311 }
312
313 return 0;
314
315error:
316 LM_ERR("Receive binary packet buffer overflow\n");
317 return -1;
318}
319
320/*
321 * pops an str from the current position in the packet

Callers 5

unpack_update_fieldsFunction · 0.85
receive_entity_createFunction · 0.85
entity_event_receivedFunction · 0.85
dlg_replicated_updateFunction · 0.85
receive_prof_replFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected