get_string_token() accessed s[strlen(s) - 1] without checking
for empty strings. If a configuration value is present but empty,
this results in an out-of-bound read.
Add explicit empty string check before accessing last character.
Pair-Programmed-With: Dmitry Mikhalchenko <tascad@altlinux.org>
Signed-off-by: Daniil Sarafannikov <sarafannikovda@sgu.ru>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
char *key;
const char *s2;
- if (s != NULL && s[0] != '%' && s[strlen(s)-1] != '%') {
+ if (s != NULL && s[0] != '\0' && s[0] != '%' && s[strlen(s)-1] != '%') {
return s;
}