summaryrefslogtreecommitdiff
path: root/testing/Messenger_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'testing/Messenger_test.c')
-rw-r--r--testing/Messenger_test.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c
index 19ab4cc3..f38eb962 100644
--- a/testing/Messenger_test.c
+++ b/testing/Messenger_test.c
@@ -50,14 +50,14 @@
50 50
51#endif 51#endif
52 52
53//horrible function from one of my first C programs. 53//TODO: rewrite
54//only here because I was too lazy to write a proper one.
55unsigned char * hex_string_to_bin(char hex_string[]) 54unsigned char * hex_string_to_bin(char hex_string[])
56{ 55{
57 unsigned char * val = malloc(strlen(hex_string)); 56 size_t len = strlen(hex_string);
57 unsigned char * val = malloc(len);
58 char * pos = hex_string; 58 char * pos = hex_string;
59 int i=0; 59 int i=0;
60 while(i < strlen(hex_string)) 60 while(i < len)
61 { 61 {
62 sscanf(pos,"%2hhx",&val[i]); 62 sscanf(pos,"%2hhx",&val[i]);
63 pos+=2; 63 pos+=2;