]> git.ipfire.org Git - thirdparty/bind9.git/commit
Add semantic patches to correctly check dns_name_copy(..., NULL) return code
authorOndřej Surý <ondrej@sury.org>
Mon, 9 Sep 2019 10:14:39 +0000 (12:14 +0200)
committerMark Andrews <marka@isc.org>
Tue, 1 Oct 2019 00:43:26 +0000 (10:43 +1000)
commit406eba0c4125c99ec4c79839a8a890b812225ca4
tree471a173f8ce7c0572e507add5bacd79214215b6e
parent98886bab43fd27d50cca373566c048db4aa373b6
Add semantic patches to correctly check dns_name_copy(..., NULL) return code

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.
cocci/dns_name_copy-with-result.spatch [new file with mode: 0644]
cocci/dns_name_copy.spatch [new file with mode: 0644]