Sorry, I forgot to show you this from gdb, which confirm k1 was probably 0. (gdb) p k $4 = 80 (gdb) p k1 $5 = 4294967295 (gdb) p k2 $6 = 4294967281 (gdb) p k3 $7 = <value optimized out> (gdb) p n $8 = 4120 (gdb) p reqStrSize $9 = 167