Static analyzer fixes
[silc.git] / lib / silcutil / silcbuffmt.c
index 98836b61768a3771c2b8a7059db6e7cab728b0d3..864a1b8599057186afa27f90ca2a0de06ea1e314 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2007 Pekka Riikonen
+  Copyright (C) 1997 - 2014 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -246,6 +246,8 @@ int silc_buffer_sformat_vp(SilcStack stack, SilcBuffer dst, va_list ap)
          silc_buffer_pull(dst, offst);
          flen += offst;
        } else {
+         if (-(offst) > (int)silc_buffer_headlen(dst))
+           goto fail;
          silc_buffer_push(dst, -(offst));
          flen += -(offst);
        }