浏览代码

[PATCH] _SPrint: fix NULL termination

maxlen is the maximum string length not the buffer size.

Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
Nigel Croxon 10 年之前
父节点
当前提交
dada63fd3d
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lib/print.c

+ 1 - 1
lib/print.c

@@ -345,7 +345,7 @@ _SPrint (
     if (spc->len < spc->maxlen) {
         spc->str[spc->len] = 0;
     } else if (spc->maxlen) {
-        spc->str[spc->maxlen-1] = 0;
+        spc->str[spc->maxlen] = 0;
     }
 
     return 0;