string: avoid undefined behavior in strrchr()
authorJan Beulich <jbeulich@suse.com>
Wed, 13 Mar 2019 10:23:28 +0000 (11:23 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 13 Mar 2019 10:23:28 +0000 (11:23 +0100)
commit592b5fcb984487f1929d28e1f4eb49d25c2c719d
tree417b83b2a9e4027e04148e94b0f46da41d09b8f5
parentfa6eba8d351f7134f47696c726ff1a2133bca5af
string: avoid undefined behavior in strrchr()

The pre-decrement would not only cause misbehavior when wrapping (benign
because there shouldn't be any NULL pointers passed in), but may also
create a pointer pointing outside the object that the passed in pointer
points to (it won't be de-referenced though).

Take the opportunity and also
- convert bogus space (partly 7 of them) indentation to Linux style tab
  one,
- add two blank lines.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/common/string.c