Jelajahi Sumber

fix confstr return value

per the specification, the terminating null byte is counted.

(cherry picked from commit 0a8d98285f46f721dabf38485df916c02d6a4675)
Timo Teräs 11 tahun lalu
induk
melakukan
f96f47d059
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      src/conf/confstr.c

+ 1 - 1
src/conf/confstr.c

@@ -13,5 +13,5 @@ size_t confstr(int name, char *buf, size_t len)
 	}
 	// snprintf is overkill but avoid wasting code size to implement
 	// this completely useless function and its truncation semantics
-	return snprintf(buf, len, "%s", s);
+	return snprintf(buf, len, "%s", s) + 1;
 }