include::../description.adoc[]

== Noncompliant Code Example

----
char *p1 = ... ;
if (p1 == NULL && *p1 == '\t') { // Noncompliant, p1 will be dereferenced IFF it is null
  // ...
}

char *p2 = ... ;
if (p2 != NULL) {
    // ...
}
*p2 = '\t'; // Noncompliant; potential null-dereference

char *p3, *p4;
p3 = NULL;
// ...
p4 = p3;
*p4 = 'a';  // Noncompliant
----

== Compliant Solution

----
char *p1 = ... ;
if (p1 != NULL && *p1 == '\t') { // Compliant, *p1 cannot be evaluated when p1 is NULL
  // ...
}

char *p2 = ... ;
if (p2 != NULL) {
    // ...
  *p2 = '\t'; // Compliant
}
----

include::../see.adoc[]

ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
