﻿# Классический C, классические ошибки проекта GmSSL

Пока ИИ осваивает новые способы ошибиться, люди по\-прежнему верны старым добрым опечаткам и ошибкам при работе с памятью\. Давайте взглянем на эту классику\.

![1427_GmSSL_ru/image1.png](https://import.viva64.com/docx/blog/1427_GmSSL_ru/image1.png)

Один из читателей предложил нам проверить проект [GmSSL](https://github.com/guanzhi/GmSSL)\. Так как мы редко проверяем проекты, созданные в Китае, решили уделить ему время\.

GmSSL — это разработанная Пекинским университетом открытая криптографическая библиотека на C, которая полностью реализует китайские коммерческие стандарты шифрования \(SM2/SM3/SM4/SM9\) и безопасные протоколы связи \(TLCP, TLS 1\.2/1\.3\)\. Отличается сверхлёгкостью и может использоваться даже в маломощных встраиваемых системах без динамической памяти, поддерживает аппаратные модули SDF/SKF\.

На этот раз особенно критичных или необычных ошибок не обнаружилось\. Зато нашлись самые типичные и привычные\. Впрочем, из\-за "стандартности" баги не перестают быть багами\. Давайте посмотрим на них\.

## Потенциальное разыменование нулевого указателя

```cpp
static int tls12_select_parameters(TLS_CONNECT *conn,
  const int *common_cipher_suites, ....)
{
  const uint8_t *cert_chains = conn->ctx->cert_chains;
  size_t cert_chains_len = conn->ctx->cert_chains_len;
  size_t cert_chain_idx;

  if (!conn || !common_cipher_suites || !common_cipher_suites_cnt
    || !common_supported_groups || !common_supported_groups_cnt
    || !common_signature_algorithms || !common_signature_algorithms_cnt)
  {
    error_print();
    return -1;
  }
  ....
}
```

Предупреждение PVS\-Studio: [V595](https://pvs-studio.ru/ru/docs/warnings/v595/) The 'conn' pointer was utilized before it was verified against nullptr\. Check lines: 807, 811\. tls12\.c 807

Из наличия проверки указателя `conn` можно сделать вывод, что он может оказаться равным `NULL`\. Однако до проверки этот указатель разыменовывается:

```cpp
const uint8_t *cert_chains = conn->ctx->cert_chains;
....
if (!conn
```

Проверка входных аргументов явно должна быть расположена выше — в самом начале функции\.

## Потенциальные утечки памяти

Ручное управление памятью в C часто приводит к сценарию, когда во внутренних обработчиках ошибок забывают освободить память\. GmSSL здесь не исключение\.

```cpp
static int test_sm4_ctr_test_vectors(void)
{
  ....
  uint8_t *plaintext;
  ....
  if ((plaintext =
         (uint8_t *)malloc(strlen(tests[i].plaintext)/2)) == NULL)
  {
    error_print();
    return -1;
  }
  if ((ciphertext =
         (uint8_t *)malloc(strlen(tests[i].ciphertext)/2)) == NULL)
  {
    error_print();
    return -1;
  }
  ....
}
```

Предупреждение PVS\-Studio: [V773](https://pvs-studio.ru/ru/docs/warnings/v773/) The function was exited without releasing the 'plaintext' pointer\. A memory leak is possible\. sm4\_ctrtest\.c 101

Если второй вызов `malloc` закончится неудачей, то произойдёт выход из функции без предварительной очистки памяти, на которую указывает `plaintext`\. Т\.е\. не будет освобождена память, выделенная ранее под другой буфер\.

<details>
   <summary>Аналогичные места, где может произойти утечка памяти:</summary>

1. V773 The function was exited without releasing the 'aad' pointer\. A memory leak is possible\. sm4\_ccmtest\.c 128
1. V773 The function was exited without releasing the 'encrypted' pointer\. A memory leak is possible\. sm4\_ctrtest\.c 115
1. V773 The function was exited without releasing the 'decrypted' pointer\. A memory leak is possible\. sm4\_ctrtest\.c 123
1. V773 The function was exited without releasing the 'plaintext' pointer\. A memory leak is possible\. sm4\_cbctest\.c 124
1. V773 The function was exited without releasing the 'plaintext' pointer\. A memory leak is possible\. sm4\_ofbtest\.c 113
1. V773 The function was exited without releasing the 'encrypted' pointer\. A memory leak is possible\. sm4\_ofbtest\.c 127
1. V773 The function was exited without releasing the 'decrypted' pointer\. A memory leak is possible\. sm4\_ofbtest\.c 135
1. V773 The function was exited without releasing the 'plaintext' pointer\. A memory leak is possible\. sm4\_cfbtest\.c 122
1. V773 The function was exited without releasing the 'plaintext' pointer\. A memory leak is possible\. sm4\_xtstest\.c 115
1. V773 The function was exited without releasing the 'encrypted' pointer\. A memory leak is possible\. sm4\_xtstest\.c 129
1. V773 The function was exited without releasing the 'decrypted' pointer\. A memory leak is possible\. sm4\_xtstest\.c 137
1. V773 The function was exited without releasing the 'plaintext' pointer\. A memory leak is possible\. sm4\_ccmtest\.c 132
1. V773 The function was exited without releasing the 'encrypted' pointer\. A memory leak is possible\. sm4\_ccmtest\.c 148
1. V773 The function was exited without releasing the 'decrypted' pointer\. A memory leak is possible\. sm4\_ccmtest\.c 155


</details>
## Опечатки

```cpp
int skfutil_main(int argc, char **argv)
{
  int ret = 1;
  ....
  } else if (!strcmp(*argv, "-lib")) {      // <=
    if (--argc < 1) goto bad;
    lib = *(++argv);
  } else if (!strcmp(*argv, "-lib")) {      // <=
    if (--argc < 1) goto bad;
    devname = *(++argv);
  } else if (!strcmp(*argv, "-devinfo")) {
  ....
}
```

Предупреждение PVS\-Studio: [V517](https://pvs-studio.ru/ru/docs/warnings/v517/) The use of 'if \(A\) \{\.\.\.\} else if \(A\) \{\.\.\.\}' pattern was detected\. There is a probability of logical error presence\. Check lines: 85, 88\. skfutil\.c 85

В двух ветках, где проверяется наличие ключа `-lib`, выполняются разные действия\. Это явная ошибка, так как вторая ветка недостижима\. Во втором случае должен проверяться ключ `-dev`\.

Рассмотри другую опечатку — дублирование оператора `goto`\.

```cpp
int sdfencrypt_main(int argc, char **argv)
{
  ....
  if (!strcmp(*argv, "-help")) {
    printf("usage: gmssl %s %s\n", prog, usage);
    printf("%s\n", options);
    ret = 0;
    goto end;
    goto end;
  } else if (!strcmp(*argv, "-lib")) {
  ....
}
```

Предупреждение PVS\-Studio: [V779](https://pvs-studio.ru/ru/docs/warnings/v779/) Unreachable code detected\. It is possible that an error is present\. sdfencrypt\.c 86

В данном случае эта опечатка не приводит к каким\-либо последствиям\. Но это не значит, что подобные опечатки всегда безобидны: вспоминается CVE\-2014\-1266 — [Finding More Than One Worm in the Apple: If you see something, say something](https://queue.acm.org/doi/10.1145/2620660.2620662)\.

Ещё одно такое срабатывание: V779 Unreachable code detected\. It is possible that an error is present\. sdfdecrypt\.c 86

## Ошибка затирания приватных данных

В криптографических библиотеках принято "убирать" за собой, затирая более неиспользуемые приватные данные\. Часто для этого применяют `memset`, и это ошибка\. Оптимизирующий компилятор видит, что после вызова функции `memset` память больше не используется, и убирает этот вызов\. Подробнее: [CWE\-14: Compiler Removal of Code to Clear Buffers](https://cwe.mitre.org/data/definitions/14.html)\.

Рассмотрим самую короткую функцию с такой ошибкой:

```cpp
void sha224_finish(SHA224_CTX *ctx, unsigned char dgst[SHA224_DIGEST_SIZE])
{
  uint8_t buf[SHA256_DIGEST_SIZE];
  sha256_finish((SHA256_CTX *)ctx, buf);
  memcpy(dgst, buf, SHA224_DIGEST_SIZE);
  memset(buf, 0, sizeof(buf));
}
```

Предупреждение PVS\-Studio: [V597](https://pvs-studio.ru/ru/docs/warnings/v597/) The compiler could delete the 'memset' function call, which is used to flush 'buf' buffer\. The memset\_s\(\) function should be used to erase the private data\. sha2\.c 196

<details>
   <summary>Другие функции, некорректно затирающие память\\\. </summary>

1. V597 The compiler could delete the 'memset' function call, which is used to flush 'buf' buffer\. The memset\_s\(\) function should be used to erase the private data\. sha2\.c 380
1. V597 The compiler could delete the 'memset' function call, which is used to flush 'buf' buffer\. The memset\_s\(\) function should be used to erase the private data\. sha2\.c 402
1. V597 The compiler could delete the 'memset' function call, which is used to flush 'buf' buffer\. The memset\_s\(\) function should be used to erase the private data\. sha2\.c 423
1. V597 The compiler could delete the 'memset' function call, which is used to flush 'dgst' buffer\. The memset\_s\(\) function should be used to erase the private data\. sm3\_kdf\.c 52
1. V597 The compiler could delete the 'memset' function call, which is used to flush 'ctx' object\. The memset\_s\(\) function should be used to erase the private data\. sm3\_pbkdf2\.c 142
1. V597 The compiler could delete the 'memset' function call, which is used to flush 'key\_block' buffer\. The memset\_s\(\) function should be used to erase the private data\. sm3\_pbkdf2\.c 143
1. V597 The compiler could delete the 'memset' function call, which is used to flush 'tmp\_block' buffer\. The memset\_s\(\) function should be used to erase the private data\. sm3\_pbkdf2\.c 144
1. V597 The compiler could delete the 'memset' function call, which is used to flush 'ctx' object\. The memset\_s\(\) function should be used to erase the private data\. sm2\_enc\.c 56
1. V597 The compiler could delete the 'memset' function call, which is used to flush 'dgst' buffer\. The memset\_s\(\) function should be used to erase the private data\. sm2\_enc\.c 57
1. V597 The compiler could delete the 'memset' function call, which is used to flush 'buf' buffer\. The memset\_s\(\) function should be used to erase the private data\. sm3\.c 210
1. V597 The compiler could delete the 'memset' function call, which is used to flush 'sm3\_ctx' object\. The memset\_s\(\) function should be used to erase the private data\. sm3\.c 213
1. V597 The compiler could delete the 'memset' function call, which is used to flush 'buf' buffer\. The memset\_s\(\) function should be used to erase the private data\. sm3\_hmac\.c 164
1. V597 The compiler could delete the 'memset' function call, which is used to flush 'buf' buffer\. The memset\_s\(\) function should be used to erase the private data\. ghash\.c 178
1. V597 The compiler could delete the 'memset' function call, which is used to flush 'ghash\_ctx' object\. The memset\_s\(\) function should be used to erase the private data\. ghash\.c 181
1. V597 The compiler could delete the 'memset' function call, which is used to flush 'buf' buffer\. The memset\_s\(\) function should be used to erase the private data\. sdfdigest\.c 244
1. V597 The compiler could delete the 'memset' function call, which is used to flush 'sm3\_ctx' object\. The memset\_s\(\) function should be used to erase the private data\. sm3\_kdf\.c 51


</details>
## Ошибка формирования 64\-битной маски

```cpp
int sm2_z256_get_booth(const sm2_z256_t a,
                       unsigned int window_size, int i)
{
  uint64_t mask = (1 << window_size) - 1;
  ....
}
```

Предупреждение PVS\-Studio: [V629](https://pvs-studio.ru/ru/docs/warnings/v629/) Consider inspecting the '1 << window\_size' expression\. Bit shifting of the 32\-bit value with a subsequent expansion to the 64\-bit type\. sm2\_z256\.c 336

В функции формируется 64\-битная маска\. Однако не получится выставить старшие биты, так как числовой литерал `1` имеет тип `int`\. Будет возникать переполнение\. Правильный вариант кода:

```cpp
uint64_t mask = (1ui64 << window_size) - 1;
```

Схожее срабатывание: V629 Consider inspecting the '1 << window\_size' expression\. Bit shifting of the 32\-bit value with a subsequent expansion to the 64\-bit type\. sm9\_z256\.c 344

## Ошибка в логике

```cpp
int tls13_process_client_pre_shared_key_from_ticket(
  TLS_CONNECT *conn, const uint8_t *ext_data, size_t ext_datalen)
{
  int ret;
  ....
  for (i = 0; identitieslen; i++) {
  ....
    if ((ret = tls13_psk_binder_verify(conn->digest,
      pre_shared_key, sizeof(pre_shared_key),
      &dgst_ctx, binder, binderlen)) != 1) {
      error_print();
      return -1;
    } else if (ret == 0) {
      continue;
    }
  ....
}
```

Предупреждение PVS\-Studio: [V547](https://pvs-studio.ru/ru/docs/warnings/v547/) Expression 'ret \=\= 0' is always false\. tls\_psk\.c 1572

Оператор `continue` никогда не выполнится, потому что в этом месте переменная `ret` всегда равна `1`\. Сокращённый код для наглядности:

```cpp
if ((ret = foo()) != 1) {
  ....
} else if (ret == 0) {  // Здесь ret равен 1
```

Здесь какая\-то логическая ошибка или опечатка\.

Есть ещё две схожих ошибки:

1. V547 Expression 'ret \=\= 0' is always false\. tls\_psk\.c 1897
1. V547 Expression 'ret \=\= 0' is always false\. tlcp\.c 2042

## Использование неинициализированной переменной

```cpp
int tls12_cert_chains_select(....)
{
  ....
  for (i = 1; cert_chains_len; i++) {
    const uint8_t *cert_chain;
    size_t cert_chain_len;
    int sig_alg;
    int ret;

    if (tls_uint24array_from_bytes(&cert_chain, &cert_chain_len,
      &cert_chains, &cert_chains_len) != 1) {
      error_print();
      return -1;
    }

    if (certs) *certs = cert_chain;
    if (certs_len) *certs_len = cert_chain_len;
    if (certs_idx) *certs_idx = i;
    if (prefered_sig_alg) *prefered_sig_alg = sig_alg;       // <=
    return 1;
  }
  ....
}
```

Предупреждение PVS\-Studio: [V614](https://pvs-studio.ru/ru/docs/warnings/v614/) Uninitialized variable 'sig\_alg' used\. tls\_cert\.c 623

Используется неинициализированная переменная `sig_alg`\. Видимо, в этом коде пропущена какая\-то логика, меняющая значение этой переменной\.

P\.S\. В юнит\-тестах библиотеки GmSSL часто используются буферы с неинициализированными данными\. Т\.е\. выполняются различные операции над мусорными данными\. Не берусь судить о корректности этого подхода, так как он явно выбран осознано\. В любом случае, такой код юнит\-тестов "пахнет", поэтому я решил упомянуть этом в статье\.

<details>
   <summary>Пример осознанного использования неинициализированного массива\\\.</summary>

```cpp
#define GETU32(p) \
  ((uint32_t)(p)[0] << 24 | \
   (uint32_t)(p)[1] << 16 | \
   (uint32_t)(p)[2] <<  8 | \
   (uint32_t)(p)[3])

#define PUTU32(p,V) \
  ((p)[0] = (uint8_t)((V) >> 24), \
   (p)[1] = (uint8_t)((V) >> 16), \
   (p)[2] = (uint8_t)((V) >>  8), \
   (p)[3] = (uint8_t)(V))

void sm4_encrypt(const SM4_KEY *key,
                 const uint8_t in[16], uint8_t out[16])
{
  uint32_t X0, X1, X2, X3, X4;
  int i;

  X0 = GETU32(in     );
  X1 = GETU32(in +  4);
  X2 = GETU32(in +  8);
  X3 = GETU32(in + 12);

  for (i = 0; i < 32; i++) {

    X4 = X1 ^ X2 ^ X3 ^ key->rk[i];
    X4 = S32(X4);
    X4 = X0 ^ L32(X4);

    X0 = X1;
    X1 = X2;
    X2 = X3;
    X3 = X4;
  }

  PUTU32(out     , X3);
  PUTU32(out +  4, X2);
  PUTU32(out +  8, X1);
  PUTU32(out + 12, X0);
}

static int speed_sm4_encrypt(void)
{
  SM4_KEY sm4_key;
  uint8_t key[16] = {0};
  uint8_t buf[16];
  size_t nbytes = 16 * 1024 * 1024;
  clock_t begin, end;
  double seconds;
  size_t i;

  sm4_set_encrypt_key(&sm4_key, key);
  for (i = 0; i < nbytes/sizeof(buf); i++) {
    sm4_encrypt(&sm4_key, buf, buf);      // <= buf не инициализирован
  }
  ....
}
```

Предупреждение PVS\-Studio: V614 Uninitialized buffer 'buf' used\. Consider checking the second actual argument of the 'sm4\_encrypt' function\. sm4test\.c 199



Другие аналогичные срабатывания PVS\-Studio:

1. V614 Uninitialized buffer 'data' used\. Consider checking the third actual argument of the 'tls\_record\_set\_application\_data' function\. tlstest\.c 404
1. V614 Uninitialized buffer 'verify\_data' used\. Consider checking the third actual argument of the 'tls\_record\_set\_handshake\_finished' function\. tlstest\.c 342
1. V614 Uninitialized buffer 'sig' used\. Consider checking the third actual argument of the 'tls\_record\_set\_handshake\_certificate\_verify' function\. tlstest\.c 320
1. V614 Uninitialized buffer 'random' used\. Consider checking the fourth actual argument of the 'tls\_record\_set\_handshake\_server\_hello' function\. tlstest\.c 254
1. V614 Uninitialized buffer 'random' used\. Consider checking the fourth actual argument of the 'tls\_record\_set\_handshake\_client\_hello' function\. tlstest\.c 229
1. V614 Uninitialized buffer 'iv' used\. Consider checking the third actual argument of the 'zuc\_init' function\. zuctest\.c 508
1. V614 Uninitialized buffer 'key' used\. Consider checking the second actual argument of the 'zuc\_init' function\. zuctest\.c 508
1. V614 Uninitialized buffer 'iv' used\. Consider checking the third actual argument of the 'zuc\_init' function\. zuctest\.c 480
1. V614 Uninitialized buffer 'key' used\. Consider checking the second actual argument of the 'zuc\_init' function\. zuctest\.c 480
1. V614 Uninitialized buffer 'blocks' used\. Consider checking the second actual argument of the 'ghash\_update' function\. ghashtest\.c 169
1. V614 Uninitialized buffer 'msg' used\. Consider checking the second actual argument of the 'hss\_sign\_update' function\. lmstest\.c 895
1. V614 Uninitialized buffer 'msg' used\. Consider checking the second actual argument of the 'hss\_sign\_update' function\. lmstest\.c 845
1. V614 Uninitialized buffer 'msg' used\. Consider checking the second actual argument of the 'hss\_sign\_update' function\. lmstest\.c 796
1. V614 Uninitialized buffer 'msg' used\. Consider checking the second actual argument of the 'lms\_sign\_update' function\. lmstest\.c 417
1. V614 Uninitialized buffer 'serial\_buf' used\. Consider checking the eighth actual argument of the 'cms\_signer\_infos\_add\_signer\_info' function\. cmstest\.c 494
1. V614 Uninitialized buffer 'sig\_buf' used\. Consider checking the tenth actual argument of the 'cms\_signer\_info\_to\_der' function\. cmstest\.c 331
1. V614 Uninitialized buffer 'serial\_buf' used\. Consider checking the fourth actual argument of the 'cms\_signer\_info\_to\_der' function\. cmstest\.c 327
1. V614 Uninitialized buffer 'c3' used\. Consider checking the fourth actual argument of the 'sm9\_ciphertext\_to\_der' function\. sm9test\.c 858
1. V614 Uninitialized buffer 'c2' used\. Consider checking the second actual argument of the 'sm9\_ciphertext\_to\_der' function\. sm9test\.c 858
1. V614 Uninitialized buffer '\(uint8\_t \*\) buf' used\. Consider checking the sixth actual argument of the 'sm4\_ccm\_encrypt' function\. sm4\_ccmtest\.c 382
1. V614 Uninitialized buffer 'aad' used\. Consider checking the fourth actual argument of the 'sm4\_ccm\_encrypt' function\. sm4\_ccmtest\.c 382
1. V614 Uninitialized buffer 'iv' used\. Consider checking the second actual argument of the 'sm4\_ccm\_encrypt' function\. sm4\_ccmtest\.c 382
1. V614 Uninitialized buffer 'msg' used\. Consider checking the second actual argument of the 'x509\_sign\_update' function\. x509\_keytest\.c 434
1. V614 Uninitialized buffer 'attrs' used\. Consider checking the fifth actual argument of the 'x509\_req\_sign\_to\_der' function\. x509\_reqtest\.c 161
1. V614 Uninitialized buffer 'attrs\_buf' used\. Consider checking the fifth actual argument of the 'x509\_request\_info\_to\_der' function\. x509\_reqtest\.c 52
1. V614 Uninitialized buffer 'iv' used\. Consider checking the seventh actual argument of the 'pbes2\_algor\_to\_der' function\. pkcs8test\.c 234
1. V614 Uninitialized buffer 'iv' used\. Consider checking the seventh actual argument of the 'pbes2\_params\_to\_der' function\. pkcs8test\.c 185
1. V614 Uninitialized variable 'saltlen' used\. Consider checking the sixth actual argument of the 'format\_bytes' function\. pkcs8test\.c 115
1. V614 Uninitialized pointer 'psalt' used\. Consider checking the fifth actual argument of the 'format\_bytes' function\. pkcs8test\.c 115
1. V614 Uninitialized buffer 'plaintext' used\. Consider checking the second actual argument of the 'sm2\_encrypt\_update' function\. sm2\_enctest\.c 338
1. V614 Uninitialized buffer 'msg' used\. Consider checking the second actual argument of the 'sm2\_sign\_update' function\. sm2\_signtest\.c 196
1. V614 Uninitialized buffer '\(uint8\_t \*\) buf' used\. Consider checking the sixth actual argument of the 'sm4\_gcm\_encrypt' function\. sm4\_gcmtest\.c 547
1. V614 Uninitialized buffer 'aad' used\. Consider checking the fourth actual argument of the 'sm4\_gcm\_encrypt' function\. sm4\_gcmtest\.c 547
1. V614 Uninitialized buffer 'iv' used\. Consider checking the second actual argument of the 'sm4\_gcm\_encrypt' function\. sm4\_gcmtest\.c 547
1. V614 Uninitialized buffer 'blocks' used\. Consider checking the second actual argument of the 'sm3\_update' function\. sm3test\.c 189
1. V614 Uninitialized buffer 'buf1' used\. Consider checking the third actual argument of the 'sm4\_cbc\_padding\_encrypt' function\. sm4\_cbctest\.c 169
1. V614 Uninitialized buffer '\(uint8\_t \*\) buf' used\. Consider checking the third actual argument of the 'sm4\_ctr32\_encrypt\_blocks' function\. sm4test\.c 336
1. V614 Uninitialized buffer '\(uint8\_t \*\) buf' used\. Consider checking the third actual argument of the 'sm4\_ctr\_encrypt\_blocks' function\. sm4test\.c 308
1. V614 Uninitialized buffer '\(uint8\_t \*\) buf' used\. Consider checking the third actual argument of the 'sm4\_cbc\_decrypt\_blocks' function\. sm4test\.c 280
1. V614 Uninitialized buffer '\(uint8\_t \*\) buf' used\. Consider checking the third actual argument of the 'sm4\_cbc\_encrypt\_blocks' function\. sm4test\.c 253
1. V614 Uninitialized buffer '\(uint8\_t \*\) buf' used\. Consider checking the second actual argument of the 'sm4\_encrypt\_blocks' function\. sm4test\.c 225
1. V614 Uninitialized buffer 'attrs' used\. Consider checking the fifth actual argument of the 'x509\_req\_sign\_to\_der' function\. reqgen\.c 245
1. V614 Uninitialized buffer 'data' used\. Consider checking the second actual argument of the 'cms\_content\_info\_to\_der' function\. cms\.c 2451
1. V614 Uninitialized buffer 'data' used\. Consider checking the second actual argument of the 'cms\_content\_info\_to\_der' function\. cms\.c 2349
1. V614 Uninitialized buffer 'data' used\. Consider checking the second actual argument of the 'cms\_content\_info\_to\_der' function\. cms\.c 2250
1. V614 Uninitialized buffer 'data' used\. Consider checking the second actual argument of the 'cms\_content\_info\_to\_der' function\. cms\.c 2167
1. V614 Uninitialized buffer 'data' used\. Consider checking the second actual argument of the 'cms\_content\_info\_to\_der' function\. cms\.c 2099
1. V614 Uninitialized buffer 'data' used\. Consider checking the second actual argument of the 'cms\_content\_info\_to\_der' function\. cms\.c 2064


</details>
## Заключение

Как ошибаются люди — хорошо известно\. Скачивайте и используйте [PVS\-Studio](https://pvs-studio.ru/ru/pvs-studio/download/), чтобы найти такие ошибки и потенциальные уязвимости как можно раньше\.

Как ошибается ИИ — мы [изучаем](https://pvs-studio.ru/ru/blog/posts/cpp/1402/) и уже вырисовывается, куда надо двигаться в развитии анализатора\. Например, это выявление дубликатов/схожего кода\. В любом случае, анализатор PVS\-Studio уже может помочь вам присмотреть за ИИ\.