From 043d3bc72689e464929e2b8da7efa97e08c9d853 Mon Sep 17 00:00:00 2001
From: zooko <zooko@zooko.com>
Date: Fri, 28 Sep 2007 04:25:34 +0530
Subject: [PATCH] zfec: don't use vsnprintf (because it is named _vsnprintf and
 has slightly different semantics in the Microsoft C library) -- vsprintf is
 good enough for this purpose

darcs-hash:5119f21d54da904a47f1a664c7d67eeeca0823b6
---
 zfec/zfec/_fecmodule.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/zfec/zfec/_fecmodule.c b/zfec/zfec/_fecmodule.c
index 9050300..4939a8c 100644
--- a/zfec/zfec/_fecmodule.c
+++ b/zfec/zfec/_fecmodule.c
@@ -20,13 +20,14 @@ static char fec__doc__[] = "\
 FEC - Forward Error Correction \n\
 ";
 
+/* NOTE: if the complete expansion of the args (by vsprintf) exceeds 1024 then memory will be invalidly overwritten. */
 static PyObject *
 py_raise_fec_error(const char *format, ...) {
     char exceptionMsg[1024];
     va_list ap;
 
     va_start (ap, format);
-    vsnprintf (exceptionMsg, 1024, format, ap);
+    vsprintf (exceptionMsg, format, ap); /* Make sure that this can't exceed 1024 chars! */
     va_end (ap);
     exceptionMsg[1023]='\0';
     PyErr_SetString (py_fec_error, exceptionMsg);
-- 
2.45.2