N1570 states that this is undefined behavior:
§J.2/1 The value of an object with automatic storage duration is used while it is indeterminate (6.2.4
See this example
char * ptr;
Since ptr is not pointing to any object, dereferencing it invokes undefined behavior. But when you pass its address to strtol, having syntax
long int strtol(const char *nptr, char **endptr, int base);
in statement
long parsed = strtol("11110111", &ptr, 2);
the endptr parameter of strtol is pointing to object ptr and derefeencing it will not invoke any UB.