Changed initialize_stringsafe to actually null terminate the underlying char array and check for zero length allocations