x86[-64]: Fix arch_cpu_user_strlcpy() for small buffers
The case for small buffers was broken, since scasb operates on edi/rdi, not esi/rsi.
This commit is contained in:
parent
2bf492b64b
commit
bcbf22a316
@ -264,9 +264,12 @@ FUNCTION(arch_cpu_user_strlcpy):
|
||||
/* count remaining bytes in src */
|
||||
.L_user_strlcpy_source_count:
|
||||
not %ecx
|
||||
# %ecx was 0 and is now max
|
||||
xor %al,%al
|
||||
movl %esi,%edi
|
||||
repnz
|
||||
scasb
|
||||
movl %edi,%esi
|
||||
|
||||
.L_user_strlcpy_source_done:
|
||||
movl %esi,%eax
|
||||
|
@ -251,9 +251,12 @@ FUNCTION(arch_cpu_user_strlcpy):
|
||||
.L_user_strlcpy_source_count:
|
||||
// Count remaining bytes in src
|
||||
not %rcx
|
||||
# %rcx was 0 and is now max
|
||||
xor %al, %al
|
||||
movl %rsi, %rdi
|
||||
repnz
|
||||
scasb
|
||||
movl %rdi, %rsi
|
||||
|
||||
.L_user_strlcpy_source_done:
|
||||
// Restore the old fault handler
|
||||
|
Loading…
Reference in New Issue
Block a user