trafgen: Replace variable length arrays

Use zmalloc()'ed buffer or statically sized array to replace usage of
variable sized arrays. Found by the sparse static checker.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>