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:
@@ -264,9 +264,12 @@ FUNCTION(arch_cpu_user_strlcpy):
|
|||||||
/* count remaining bytes in src */
|
/* count remaining bytes in src */
|
||||||
.L_user_strlcpy_source_count:
|
.L_user_strlcpy_source_count:
|
||||||
not %ecx
|
not %ecx
|
||||||
|
# %ecx was 0 and is now max
|
||||||
xor %al,%al
|
xor %al,%al
|
||||||
|
movl %esi,%edi
|
||||||
repnz
|
repnz
|
||||||
scasb
|
scasb
|
||||||
|
movl %edi,%esi
|
||||||
|
|
||||||
.L_user_strlcpy_source_done:
|
.L_user_strlcpy_source_done:
|
||||||
movl %esi,%eax
|
movl %esi,%eax
|
||||||
|
|||||||
@@ -251,9 +251,12 @@ FUNCTION(arch_cpu_user_strlcpy):
|
|||||||
.L_user_strlcpy_source_count:
|
.L_user_strlcpy_source_count:
|
||||||
// Count remaining bytes in src
|
// Count remaining bytes in src
|
||||||
not %rcx
|
not %rcx
|
||||||
|
# %rcx was 0 and is now max
|
||||||
xor %al, %al
|
xor %al, %al
|
||||||
|
movl %rsi, %rdi
|
||||||
repnz
|
repnz
|
||||||
scasb
|
scasb
|
||||||
|
movl %rdi, %rsi
|
||||||
|
|
||||||
.L_user_strlcpy_source_done:
|
.L_user_strlcpy_source_done:
|
||||||
// Restore the old fault handler
|
// Restore the old fault handler
|
||||||
|
|||||||
Reference in New Issue
Block a user