Risky: what if msglen is huge? I guess I don't care in a test, but be careful with this sort of thing in general. Proper behavior here would be to not trust the length, bound it, and then allocate an array of appropriate size on the heap to avoid a stack overflow.