From 8427a5bb25512621811cb65aaa8c8918ee652aa9 Mon Sep 17 00:00:00 2001 From: savalet Date: Wed, 30 Oct 2024 14:38:48 +0100 Subject: [PATCH] fix: put hex strcpy --- src/handler/put_hex.c | 4 ++-- src/handler/put_nbr.c | 2 -- src/handler/put_oct.c | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/handler/put_hex.c b/src/handler/put_hex.c index bcd03eb..a9f8fa9 100644 --- a/src/handler/put_hex.c +++ b/src/handler/put_hex.c @@ -23,7 +23,7 @@ int baby_put_hex(size_t nb, flags_t *flags) } str[i] = '\0'; baby_revstr(str); - flags->spec_buff.str = str; + baby_strcpy(flags->spec_buff.str, str); flags->spec_buff.count = i; return 0; } @@ -45,7 +45,7 @@ int baby_put_hex_upc(size_t nb, flags_t *flags) } str[i] = '\0'; baby_revstr(str); - flags->spec_buff.str = str; + baby_strcpy(flags->spec_buff.str, str); flags->spec_buff.count = i; return 0; } diff --git a/src/handler/put_nbr.c b/src/handler/put_nbr.c index 98d9f4a..58f93c1 100644 --- a/src/handler/put_nbr.c +++ b/src/handler/put_nbr.c @@ -5,8 +5,6 @@ ** display the number given as parameter */ -#include - #include "my.h" void printf_put_nbr(flags_t *flags) diff --git a/src/handler/put_oct.c b/src/handler/put_oct.c index eae54fb..998c599 100644 --- a/src/handler/put_oct.c +++ b/src/handler/put_oct.c @@ -22,7 +22,7 @@ int baby_put_oct(int nb, flags_t *flags) } str[i] = '\0'; baby_revstr(str); - flags->spec_buff.str = str; + baby_strcpy(flags->spec_buff.str, str); flags->spec_buff.count = i; return 0; }