浏览代码

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>
Steven Miao 14 年之前
父节点
当前提交
5ff6197f82
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      arch/blackfin/lib/strncpy.S

+ 1 - 1
arch/blackfin/lib/strncpy.S

@@ -25,7 +25,7 @@
 
 ENTRY(_strncpy)
 	CC = R2 == 0;
-	if CC JUMP 4f;
+	if CC JUMP 6f;
 
 	P2 = R2 ;       /* size */
 	P0 = R0 ;       /* dst*/