From: Dmitry Eremin Date: Fri, 31 Oct 2014 15:33:59 +0000 (+0300) Subject: LU-5383 utils: fix array index out of bounds X-Git-Tag: 2.6.90~5 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F24%2F12524%2F2;p=fs%2Flustre-release.git LU-5383 utils: fix array index out of bounds Possible attempt to access element -8..-1 of array 'ldd_svname'. Signed-off-by: Dmitry Eremin Change-Id: Ib4ec6a6d74ff6e805725d0ff4487868b7cbffa2f Reviewed-on: http://review.whamcloud.com/12524 Tested-by: Jenkins Reviewed-by: James Simmons Reviewed-by: Bob Glossman Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- diff --git a/lustre/utils/mount_lustre.c b/lustre/utils/mount_lustre.c index 8e9b00a..d32c77a 100644 --- a/lustre/utils/mount_lustre.c +++ b/lustre/utils/mount_lustre.c @@ -422,7 +422,11 @@ static int parse_ldd(char *source, struct mount_opts *mop, char *options) /* svname of the form lustre:OST1234 means never registered */ rc = strlen(ldd->ldd_svname); - if (ldd->ldd_svname[rc - 8] == ':') { + if (rc < 8) { + fprintf(stderr, "%s: invalid name '%s'\n", + progname, ldd->ldd_svname); + return EINVAL; + } else if (ldd->ldd_svname[rc - 8] == ':') { ldd->ldd_svname[rc - 8] = '-'; ldd->ldd_flags |= LDD_F_VIRGIN; } else if (ldd->ldd_svname[rc - 8] == '=') {