Author: trasz Date: Wed Apr 10 16:09:06 2019 New Revision: 346086 URL: https://svnweb.freebsd.org/changeset/base/346086
Log: Fix segfault that could occur on "automount -LL". MFC after: 2 weeks Sponsored by: DARPA, AFRL Modified: head/usr.sbin/autofs/common.c Modified: head/usr.sbin/autofs/common.c ============================================================================== --- head/usr.sbin/autofs/common.c Wed Apr 10 15:38:53 2019 (r346085) +++ head/usr.sbin/autofs/common.c Wed Apr 10 16:09:06 2019 (r346086) @@ -365,7 +365,7 @@ expand_ampersand(char *string, const char *key) * of characters before the '&'. */ before_len = i; - //assert(i + 1 < (int)strlen(string)); + //assert(i < (int)strlen(string)); ret = asprintf(&expanded, "%.*s%s%s", before_len, string, key, string + before_len + 1); @@ -380,6 +380,8 @@ expand_ampersand(char *string, const char *key) */ string = expanded; i = before_len + strlen(key); + if (i == (int)strlen(string)) + break; backslashed = false; //assert(i < (int)strlen(string)); } _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"