Commit 5ff6197f828d5ea051b3abf77cb61f8a34480e8d

Authored by Steven Miao
Committed by Mike Frysinger
1 parent 1fa7b6a29c

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>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

arch/blackfin/lib/strncpy.S
... ... @@ -25,7 +25,7 @@
25 25  
26 26 ENTRY(_strncpy)
27 27 CC = R2 == 0;
28   - if CC JUMP 4f;
  28 + if CC JUMP 6f;
29 29  
30 30 P2 = R2 ; /* size */
31 31 P0 = R0 ; /* dst*/