Fix strcat SIGSEGV crash

This commit is contained in:
2025-07-27 21:11:53 +02:00
parent 0d1a125782
commit ca6d6e6d31
2 changed files with 14 additions and 14 deletions

View File

@@ -31,8 +31,8 @@ print:
mov rsi, rdi mov rsi, rdi
call strlen call strlen
mov rdx, rax mov rdx, rax
mov rax, NR_write mov eax, NR_write
mov rdi, FD_stdout mov edi, FD_stdout
syscall syscall
add rsp, SIZE_QWORD add rsp, SIZE_QWORD
ret ret
@@ -48,11 +48,11 @@ print:
puts: puts:
sub rsp, SIZE_QWORD sub rsp, SIZE_QWORD
call print call print
mov rsi, mNL mov esi, mNL
mov r10, rax mov r10, rax
mov rax, NR_write mov eax, NR_write
mov rdi, FD_stdout mov edi, FD_stdout
mov rdx, 1 mov edx, 1
syscall syscall
mov rax, r10 mov rax, r10
inc rax inc rax

View File

@@ -1013,14 +1013,14 @@ _start:
call puts call puts
; TEST 4: strcat(strBuff1, str4, 1) ; TEST 4: strcat(strBuff1, str4, 1)
;printTest(strcat4) printTest(strcat4)
;lea rdi, [rel strBuff1] lea rdi, [rel strBuff1]
;lea rsi, [rel str4] lea rsi, [rel str4]
;mov rdx, 1 mov rdx, 1
;call strcat ;SIGSEGV call strcat ;SIGSEGV
;assert_eq(strBuff1) assert_eq(strBuff1)
;lea rdi, [rel strBuff1] lea rdi, [rel strBuff1]
;call puts call puts
%endif %endif
;--- strclr() ;--- strclr()