This read happens when the last word ends with the terminating '\0'.
After advancing the index to the '\0' it is then increased once more to
regions not accessible. This is fixed by simple skipping the ++i after a
word has been processed.
/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/20 11:51:05 by ljiriste #+# #+# */
-/* Updated: 2024/07/21 18:53:26 by ljiriste ### ########.fr */
+/* Updated: 2024/08/01 11:56:05 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
res[str_num++] = extract_substr(&str[i], seps);
i += substr_len(&str[i], seps);
}
- ++i;
+ else
+ ++i;
}
res[str_num] = NULL;
return (res);