Skip to content

Commit 5ff6197

Browse files
realmzvapier
authored andcommitted
Blackfin: strncpy: fix handling of zero lengths
The jump to 4f will cause the NUL padding loop to run at least one time, so if string length is zero just jump to the end. Otherwise we wrongly write one NUL byte when size==0. Signed-off-by: Steven Miao <realmz6@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
1 parent 1fa7b6a commit 5ff6197

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/blackfin/lib/strncpy.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
ENTRY(_strncpy)
2727
CC = R2 == 0;
28-
if CC JUMP 4f;
28+
if CC JUMP 6f;
2929

3030
P2 = R2 ; /* size */
3131
P0 = R0 ; /* dst*/

0 commit comments

Comments
 (0)