瀏覽代碼

[coverity] Override assumptions about wcrtomb() and hmac_init()

Newer versions of Coverity use built-in models for wcrtomb() and
hmac_init() that are capable of returning errors, and reports defects
due to code failing to check for these errors.  The actual iPXE
implementations are simpler than Coverity's models and can never
return errors, so these defects are false positives.

Fix by overriding Coverity's built-in models for these functions.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 4 年之前
父節點
當前提交
a5c41483d2
共有 1 個檔案被更改,包括 8 行新增0 行删除
  1. 8
    0
      contrib/coverity/model.c

+ 8
- 0
contrib/coverity/model.c 查看文件

@@ -7,6 +7,9 @@ typedef long off_t;
7 7
 typedef void * userptr_t;
8 8
 typedef long long time_t;
9 9
 struct tm;
10
+typedef unsigned short wchar_t;
11
+typedef void mbstate_t;
12
+struct digest_algorithm;
10 13
 
11 14
 /* Inhibit use of built-in models for functions where Coverity's
12 15
  * assumptions about the modelled function are incorrect for iPXE.
@@ -19,3 +22,8 @@ time_t mktime ( struct tm *tm ) {
19 22
 }
20 23
 int getchar ( void ) {
21 24
 }
25
+size_t wcrtomb ( char *buf, wchar_t wc, mbstate_t *ps ) {
26
+}
27
+void hmac_init ( struct digest_algorithm *digest, void *digest_ctx,
28
+		 void *key, size_t *key_len ) {
29
+}

Loading…
取消
儲存