Fix strsep_quote() on strings without quotes.

For strings without quotes and escapes dstptr and srcptr are equal, so
zeroing *dstptr before checking *srcptr is not a good idea.  In practice
it means that in -maproot=65534:65533 everything after the colon is lost.

The problem was there since r293305, but before r346976 it was covered by
improper strsep_quote() usage.

PR:		238725
MFC after:	3 days
Sponsored by:	iXsystems, Inc.
This commit is contained in:
Alexander Motin 2019-06-25 17:00:53 +00:00
parent 7a3e3a2859
commit 4ae6e084f0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=349376

View File

@ -385,8 +385,8 @@ strsep_quote(char **stringp, const char *delim)
*dstptr++ = *srcptr++;
}
*dstptr = 0; /* Terminate the string */
*stringp = (*srcptr == '\0') ? NULL : srcptr + 1;
*dstptr = 0; /* Terminate the string */
return (retval);
}