Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
May 30, 2023

Conversation

alexey-tikhonov
Copy link
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