- silc_buffer_unformat(buffer,
- SILC_STR_UI16_NSTRING_ALLOC(&new->data, &new->data_len),
- SILC_STR_UI16_NSTRING_ALLOC(NULL, NULL),
- SILC_STR_END);
+ ret = silc_buffer_unformat(buffer,
+ SILC_STR_UI16_NSTRING_ALLOC(&new->data,
+ &new->data_len),
+ SILC_STR_UI16_NSTRING_ALLOC(NULL, NULL),
+ SILC_STR_END);
+ if (ret == -1)
+ goto err;
if (new->data_len < 1 || new->data_len > buffer->len) {
SILC_LOG_ERROR(("Incorrect channel payload in packet, packet dropped"));
if (new->data_len < 1 || new->data_len > buffer->len) {
SILC_LOG_ERROR(("Incorrect channel payload in packet, packet dropped"));
/* Encode the Channel Payload */
silc_buffer_format(buffer,
SILC_STR_UI_SHORT(data_len),
/* Encode the Channel Payload */
silc_buffer_format(buffer,
SILC_STR_UI_SHORT(data_len),
SILC_LOG_DEBUG(("Parsing channel key payload"));
new = silc_calloc(1, sizeof(*new));
/* Parse the Channel Key Payload */
SILC_LOG_DEBUG(("Parsing channel key payload"));
new = silc_calloc(1, sizeof(*new));
/* Parse the Channel Key Payload */
- silc_buffer_unformat(buffer,
- SILC_STR_UI16_NSTRING_ALLOC(&new->id, &new->id_len),
- SILC_STR_UI16_NSTRING_ALLOC(&new->cipher,
- &new->cipher_len),
- SILC_STR_UI16_NSTRING_ALLOC(&new->key, &new->key_len),
- SILC_STR_END);
+ ret =
+ silc_buffer_unformat(buffer,
+ SILC_STR_UI16_NSTRING_ALLOC(&new->id, &new->id_len),
+ SILC_STR_UI16_NSTRING_ALLOC(&new->cipher,
+ &new->cipher_len),
+ SILC_STR_UI16_NSTRING_ALLOC(&new->key, &new->key_len),
+ SILC_STR_END);
+ if (ret == -1)
+ goto err;
if (new->id_len < 1 || new->key_len < 1 || new->cipher_len < 1) {
SILC_LOG_ERROR(("Incorrect channel key payload in packet"));
if (new->id_len < 1 || new->key_len < 1 || new->cipher_len < 1) {
SILC_LOG_ERROR(("Incorrect channel key payload in packet"));
/* Allocate channel payload buffer. Length is 2 + id + 2 + key +
2 + cipher */
len = 2 + id_len + 2 + key_len + 2 + cipher_len;
/* Allocate channel payload buffer. Length is 2 + id + 2 + key +
2 + cipher */
len = 2 + id_len + 2 + key_len + 2 + cipher_len;