소스 검색

[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;