summaryrefslogtreecommitdiff
blob: 9a4734cf608d65e7e97ca7f350e5245836225741 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--- src/ARC2.c.orig	2009-03-03 23:53:08.000000000 -0430
+++ src/ARC2.c	2009-03-03 23:53:08.000000000 -0430
@@ -11,6 +11,7 @@
  */
 
 #include <string.h>  
+#include "Python.h"
 
 #define MODULE_NAME ARC2
 #define BLOCK_SIZE 8
@@ -146,6 +147,12 @@
 	   We'll hardwire it to 1024. */
 #define bits 1024
 
+    if ((U32)keylength > sizeof(self->xkey)) {
+       PyErr_SetString(PyExc_ValueError,
+               "ARC2 key length must be less than 128 bytes");
+       return;
+    }
+
 	memcpy(self->xkey, key, keylength);
   
 	/* Phase 1: Expand input key to 128 bytes */