printf(): Print null pointers (arg for %s = 0) as (null), fixes #4
This commit is contained in:
@@ -359,6 +359,21 @@ printf:
|
||||
|
||||
;--- Insert string to buffer ---;
|
||||
.insertString:
|
||||
test rsi, rsi
|
||||
jnz .doInsertString
|
||||
;rsi = NULL:
|
||||
mov r9b, 3
|
||||
cmp r10, printfBuffLen-7
|
||||
je .flushBuffer
|
||||
.flushReturn_3:
|
||||
mov byte [printfBuff + r10], '('
|
||||
mov qword [printfBuff + r10 + 1], 'null'
|
||||
mov byte [printfBuff + r10 + 5], ')'
|
||||
add r10, 6
|
||||
add r11, 6
|
||||
jmp .endInsertString
|
||||
|
||||
.doInsertString:
|
||||
cmp byte [rsi], EOS
|
||||
je .endInsertString
|
||||
mov r9b, 1
|
||||
@@ -409,6 +424,8 @@ printf:
|
||||
je .flushReturn_1
|
||||
cmp r9b, 2
|
||||
je .flushReturn_2
|
||||
cmp r9b, 3
|
||||
je .flushReturn_3
|
||||
|
||||
.wrapup:
|
||||
mov rax, NR_write
|
||||
|
Reference in New Issue
Block a user