Code auditing weekend results and fixes committing.
[silc.git] / lib / silccore / silcmode.c
index 2f04492ebbcd2a055163a94355d9eb0fcf7ff4d3..a937e365f4bf0b35e415abc323090b13ebaf63fd 100644 (file)
@@ -41,17 +41,20 @@ SilcSetModePayload silc_set_mode_payload_parse(SilcBuffer buffer)
 {
   SilcSetModePayload new;
   unsigned short len;
+  int ret;
 
   SILC_LOG_DEBUG(("Parsing Set Mode payload"));
 
   new = silc_calloc(1, sizeof(*new));
 
-  silc_buffer_unformat(buffer,
-                      SILC_STR_UI_SHORT(&new->mode_type),
-                      SILC_STR_UI_SHORT(&len),
-                      SILC_STR_UI_INT(&new->mode_mask),
-                      SILC_STR_UI_CHAR(&new->argc),
-                      SILC_STR_END);
+  ret = silc_buffer_unformat(buffer,
+                            SILC_STR_UI_SHORT(&new->mode_type),
+                            SILC_STR_UI_SHORT(&len),
+                            SILC_STR_UI_INT(&new->mode_mask),
+                            SILC_STR_UI_CHAR(&new->argc),
+                            SILC_STR_END);
+  if (ret == -1)
+    goto err;
 
   if (len > buffer->len)
     goto err;