GTA04: Fix critical mistake that caused read buffer to be 1 byte allocated
authorPaul Kocialkowski <contact@paulk.fr>
Sat, 21 Jul 2012 22:09:25 +0000 (00:09 +0200)
committerPaul Kocialkowski <contact@paulk.fr>
Sat, 21 Jul 2012 22:09:25 +0000 (00:09 +0200)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
device/gta04/gta04.c

index 20c3ed6..86a7968 100644 (file)
@@ -290,7 +290,7 @@ int gta04_transport_recv(void *sdata, void **data, int length)
        if(length == 1 && mc == 1) {
                // Read an unknown number of bytes
 
-               buffer = (char *) calloc(1, mc);
+               buffer = (char *) calloc(1, RECV_BYTES_MAX);
 
                rc = read(fd, (void *) buffer, RECV_BYTES_MAX);
                if(rc < 0) {