From 6228f215f1a99ab282688516d3d577295fa8ef5a Mon Sep 17 00:00:00 2001 From: Cristian Greco Date: Fri, 25 Feb 2011 23:51:16 +0100 Subject: Fix using sizeof() for array given as function argument When using the sizeof() operator for an array given as function argument it returns the size of the pointer. In this case, the affected function hex(char digest[16], char buff[33]) will just print 4 or 8 byte instead of the full length of 16 bytes, on 32bit and 64bit systems respectively. --- lib/erl_interface/src/connect/ei_connect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/erl_interface') diff --git a/lib/erl_interface/src/connect/ei_connect.c b/lib/erl_interface/src/connect/ei_connect.c index 6dc6ebb348..c24294fbd0 100644 --- a/lib/erl_interface/src/connect/ei_connect.c +++ b/lib/erl_interface/src/connect/ei_connect.c @@ -1197,7 +1197,7 @@ static char *hex(char digest[16], char buff[33]) char *p = buff; int i; - for (i = 0; i < sizeof(digest); ++i) { + for (i = 0; i < 16; ++i) { *p++ = tab[(int)((*d) >> 4)]; *p++ = tab[(int)((*d++) & 0xF)]; } -- cgit v1.2.3