If the namelist is not terminated with a '/', we try to read
the next character after the string termination '\0'.
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 8 21:44:16 CEST 2014 on sn-devel-104
{
char *name_end;
char *namelist;
+ char *namelist_end;
char *nameptr;
int num_entries = 0;
int i;
}
nameptr = namelist;
+ namelist_end = &namelist[strlen(namelist)];
+
/* We need to make two passes over the string. The
first to count the number of elements, the second
to split it.
*/
- while(*nameptr) {
+ while(nameptr <= namelist_end) {
if ( *nameptr == '/' ) {
/* cope with multiple (useless) /s) */
nameptr++;
/* Now copy out the names */
nameptr = namelist;
i = 0;
- while(*nameptr) {
+ while(nameptr <= namelist_end) {
if ( *nameptr == '/' ) {
/* cope with multiple (useless) /s) */
nameptr++;