printf: Prevent special characters not being processed if it was proceeded by a percentage sign (ie '%\n')
This commit is contained in:
@@ -295,6 +295,8 @@ printf:
|
||||
|
||||
;--- Invalid ---;
|
||||
.invalidReplacement:
|
||||
cmp byte [rdi + 1], '\'
|
||||
je .invalidReplacement_specialChar; '%\n' would become "'%','\','n'" instead of "'%',EOS" when inserting full invalid specifier.
|
||||
mov r9w, word [rdi]
|
||||
mov [printfBuff+r10], r9w
|
||||
add rdi, 2
|
||||
@@ -302,6 +304,14 @@ printf:
|
||||
add r11, 2
|
||||
inc r14
|
||||
jmp .process
|
||||
.invalidReplacement_specialChar:
|
||||
mov r9b, byte [rdi]
|
||||
mov [printfBuff+r10], r9b
|
||||
inc rdi
|
||||
inc r10
|
||||
inc r11
|
||||
inc r14
|
||||
jmp .process
|
||||
|
||||
;--- '%%' ---;
|
||||
.rep_pct:
|
||||
|
Reference in New Issue
Block a user