Skip to content

Commit

Permalink
Blackfin: strncpy: fix handling of zero lengths
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Steven Miao authored and Mike Frysinger committed Jun 3, 2011
1 parent 1fa7b6a commit 5ff6197
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/blackfin/lib/strncpy.S
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

ENTRY(_strncpy)
CC = R2 == 0;
if CC JUMP 4f;
if CC JUMP 6f;

P2 = R2 ; /* size */
P0 = R0 ; /* dst*/
Expand Down

0 comments on commit 5ff6197

Please sign in to comment.