--- src/gpm.c +++ src/gpm.c @@ -366,7 +366,7 @@ if((i=m_type->packetlen-howmany)) /* still to get */ do { - j = read(fd,edata-i,i); /* edata is pointer just after data */ + j = read(fd,edata-i,howmany); /* edata is pointer just after data */ if (kd_mode!=KD_TEXT && fifofd != -1 && opt_rawrep && j > 0) write(fifofd, edata-i, j); i -= j;