Skip to content

Commit c5fabf5

Browse files
zhenggenjren1
authored andcommitted
sprintf: bug fix in sprintf implemented code
In the case that the copy sz is 0, it is unnecessary to do copy. Signed-off-by: Zheng, Gen <gen.zheng@intel.com> Reviewed-by: Chen, Jason Cl <jason.cj.chen@intel.com> Reviewed-by: Yakui, Zhao <yakui.zhao@intel.com>
1 parent 9b37e14 commit c5fabf5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hypervisor/lib/sprintf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ static int charmem(int cmd, const char *s, int sz, void *hnd)
634634
n++;
635635
}
636636

637-
} else {
637+
} else if (sz > 0) {
638638
while (*s && n < sz) {
639639
if (n < param->sz - param->wrtn)
640640
*p = *s;

0 commit comments

Comments
 (0)