fix undefined behavior in getdelim via null pointer arithmetic and memcpy