feat(read): adding the return value on -1 if the buf is NULL

This commit is contained in:
Raphael 2025-12-29 16:58:18 +01:00
parent 13be686bcd
commit e84d0ea774
No known key found for this signature in database

View file

@ -7,6 +7,7 @@ section .text
ft_read: ft_read:
cmp rsi, 0 ; check if the buffer is NULL cmp rsi, 0 ; check if the buffer is NULL
mov rax, -1 ; set the return value to -1 (for error) (UB)
je .exit ; if true go to exit je .exit ; if true go to exit
mov rax, 0 ; syscall 0 is for read mov rax, 0 ; syscall 0 is for read
syscall ; call the system call read syscall ; call the system call read