aboutsummaryrefslogtreecommitdiff
path: root/libraries/barry/fix-sizeof-use.patch
blob: a3d516e3a3386f1491f870a6888113a2f8ed9a36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Description: Fix sizeof(pointer) to be sizeof(buffer_pointed_to)
Author: Olly Betts <olly@survex.com>
Forwarded: no
Last-Update: 2014-08-14

--- a/src/vformat.c
+++ b/src/vformat.c
@@ -1881,11 +1881,11 @@
 
 //static unsigned char _evc_base64_rank[256];
 
-static void base64_init(char *rank)
+static void base64_init(char *rank, size_t len)
 {
 	int i;
 
-	memset(rank, 0xff, sizeof(rank));
+	memset(rank, 0xff, len);
 	for (i=0;i<64;i++) {
 		rank[(unsigned int)base64_alphabet[i]] = i;
 	}
@@ -2011,7 +2011,7 @@
 static size_t base64_decode_step(const unsigned char *in, size_t len, unsigned char *out, int *state, unsigned int *save)
 {
 	unsigned char base64_rank[256];
-	base64_init((char*)base64_rank);
+	base64_init((char*)base64_rank, sizeof(base64_rank));
 
 	register const unsigned char *inptr;
 	register unsigned char *outptr;