From: tobias Date: Mon, 11 Aug 2008 17:17:53 +0000 (+0000) Subject: Prevent a buffer underrun if a line is received which only contains X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=aecf04b9b35ad590fd1958db3895c84d7daeec22;p=openbsd Prevent a buffer underrun if a line is received which only contains (multiple) @. ok millert, otto --- diff --git a/libexec/fingerd/fingerd.c b/libexec/fingerd/fingerd.c index 4848b158f5c..cecbbdd386c 100644 --- a/libexec/fingerd/fingerd.c +++ b/libexec/fingerd/fingerd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fingerd.c,v 1.33 2006/08/19 06:01:00 ray Exp $ */ +/* $OpenBSD: fingerd.c,v 1.34 2008/08/11 17:17:53 tobias Exp $ */ /* * Copyright (c) 1983, 1993 @@ -39,7 +39,7 @@ static char copyright[] = #if 0 static char sccsid[] = "from: @(#)fingerd.c 8.1 (Berkeley) 6/4/93"; #else -static char rcsid[] = "$OpenBSD: fingerd.c,v 1.33 2006/08/19 06:01:00 ray Exp $"; +static char rcsid[] = "$OpenBSD: fingerd.c,v 1.34 2008/08/11 17:17:53 tobias Exp $"; #endif #endif /* not lint */ @@ -167,7 +167,7 @@ main(int argc, char *argv[]) } len = strlen(*ap); - while ((*ap)[len - 1] == '@') + while (len > 0 && (*ap)[len - 1] == '@') (*ap)[--len] = '\0'; if (**ap == '\0') continue;