Skip to content

Commit

Permalink
Fixed garbage unitialized value in rgb array breaking the atoi in get…
Browse files Browse the repository at this point in the history
…_texture_utils.c
  • Loading branch information
Jean Teissier authored and Jean Teissier committed Aug 29, 2024
1 parent c8a33ed commit 99381e3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions srcs/parser/get_textures_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,24 @@
/* ::: :::::::: */
/* get_textures_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tsuchen <tsuchen@student.42.fr> +#+ +:+ +#+ */
/* By: jteissie <jteissie@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/28 17:29:47 by jteissie #+# #+# */
/* Updated: 2024/08/29 11:39:01 by tsuchen ### ########.fr */
/* Updated: 2024/08/29 14:00:13 by jteissie ### ########.fr */
/* */
/* ************************************************************************** */

#include "parser.h"

static int convert_nb(char *str, int *array, size_t *array_i, size_t *i)
{
int nb;

nb = 0;
while (ft_isdigit(str[*i]))
{
array[*array_i] = 10 * array[*array_i] + (str[*i] - '0');
nb = 10 * nb + (str[*i] - '0');
array[*array_i] = nb;
if (array[*array_i] > 255)
return (PANIC);
*i = *i + 1;
Expand Down

0 comments on commit 99381e3

Please sign in to comment.