Fixed segfault in common, changed casting of packets to static_cast
This required that I switch from using a char array for the packet buffers to using malloc() and free(). They make more sense anyway, and I've learned (or relearned) something about casting.
This commit is contained in: