Skip to content

A couple of cosmetic fixed to please Coverity scan where it makes some sense - #527

Merged
bradh352 merged 3 commits into
c-ares:mainfrom
alexey-tikhonov:coverity-fixes
May 30, 2023
Merged

A couple of cosmetic fixed to please Coverity scan where it makes some sense#527
bradh352 merged 3 commits into
c-ares:mainfrom
alexey-tikhonov:coverity-fixes

Conversation

@alexey-tikhonov

Copy link
Copy Markdown
Contributor

No description provided.

Fixes following warning:
```
c-ares-1.19.1/src/lib/ares__readaddrinfo.c:69: cond_const: Condition "(status = ares__read_line(fp, &line, &linesize)) == 0", taking true branch. Now the value of "status" is equal to 0.
c-ares-1.19.1/src/lib/ares__readaddrinfo.c:181: cond_const: Condition "status != 0", taking false branch. Now the value of "status" is equal to 0.
c-ares-1.19.1/src/lib/ares__readaddrinfo.c:193: cond_const: Condition "status != 0", taking false branch. Now the value of "status" is equal to 0.
c-ares-1.19.1/src/lib/ares__readaddrinfo.c:200: const: At condition "status != 0", the value of "status" must be equal to 0.
c-ares-1.19.1/src/lib/ares__readaddrinfo.c:200: dead_error_condition: The condition "status != 0" cannot be true.
c-ares-1.19.1/src/lib/ares__readaddrinfo.c:202: dead_error_line: Execution cannot reach this statement: "continue;".
  200|         if (status != ARES_SUCCESS)
  201|           /* Ignore line if invalid address string for the requested family. */
  202|->         continue;
  203|
  204|         if (want_cname)
```
Fixes following warning:
```
c-ares-1.19.1/src/lib/ares_parse_uri_reply.c:91: cond_const: Condition "status != 0", taking false branch. Now the value of "status" is equal to 0.
c-ares-1.19.1/src/lib/ares_parse_uri_reply.c:155: const: At condition "status != 0", the value of "status" must be equal to 0.
c-ares-1.19.1/src/lib/ares_parse_uri_reply.c:155: dead_error_condition: The condition "status != 0" cannot be true.
c-ares-1.19.1/src/lib/ares_parse_uri_reply.c:156: dead_error_line: Execution cannot reach this statement: "break;".
  154|
  155|             if (status != ARES_SUCCESS)
  156|->             break;
  157|           }
  158|
```
b1fe351 merely pushed null ptr
deref to a next line.

Fixes following warning:
```
Error: FORWARD_NULL (CWE-476):
c-ares-1.19.1/src/lib/ares_getaddrinfo.c:827: var_compare_op: Comparing "hquery->name" to null implies that "hquery->name" might be null.
c-ares-1.19.1/src/lib/ares_getaddrinfo.c:828: alias_transfer: Assigning: "p" = "hquery->name".
c-ares-1.19.1/src/lib/ares_getaddrinfo.c:828: var_deref_op: Dereferencing null pointer "p".
  826|     int ndots = 0;
  827|     size_t nname = hquery->name?strlen(hquery->name):0;
  828|->   for (p = hquery->name; *p; p++)
  829|       {
  830|         if (*p == '.')
```
@bradh352
bradh352 merged commit 903a613 into c-ares:main May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants