mirror of
https://github.com/isc-projects/bind9.git
synced 2026-04-26 00:30:05 -04:00
The dns_name_copy() function cannot fail gracefully when the last argument (target) is NULL. Add RUNTIME_CHECK()s around such calls. The first semantic patch adds RUNTIME_CHECK() around any call that ignores the return value and is very safe to apply. The second semantic patch attempts to properly add RUNTIME_CHECK() to places where the return value from `dns_name_copy()` is recorded into `result` variable. The result of this semantic patch needs to be reviewed by hand. Both patches misses couple places where the code surrounding the `dns_name_copy(..., NULL)` usage is more complicated and is better suited to be fixed by a human being that understands the surrounding code.
30 lines
547 B
Text
30 lines
547 B
Text
@@
|
|
expression V, E1, E2;
|
|
statement S;
|
|
@@
|
|
|
|
- V = dns_name_copy(E1, E2, NULL);
|
|
- if (V != ISC_R_SUCCESS) S
|
|
+ RUNTIME_CHECK(dns_name_copy(E1, E2, NULL) == ISC_R_SUCCESS);
|
|
|
|
@@
|
|
expression V, E1, E2;
|
|
statement S1, S2;
|
|
@@
|
|
|
|
- V = dns_name_copy(E1, E2, NULL);
|
|
- if (V == ISC_R_SUCCESS) S1 else S2;
|
|
+ RUNTIME_CHECK(dns_name_copy(E1, E2, NULL) == ISC_R_SUCCESS);
|
|
+ S2
|
|
|
|
@@
|
|
expression V, E1, E2;
|
|
statement S1, S2;
|
|
@@
|
|
|
|
- V = dns_name_copy(E1, E2, NULL);
|
|
- S1
|
|
- if (V == ISC_R_SUCCESS) S2
|
|
+ RUNTIME_CHECK(dns_name_copy(E1, E2, NULL) == ISC_R_SUCCESS);
|
|
+ S1
|
|
+ S2
|