Просмотр исходного кода

[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 5 лет назад
Родитель
Сommit
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
+}

Загрузка…
Отмена
Сохранить