From aecf04b9b35ad590fd1958db3895c84d7daeec22 Mon Sep 17 00:00:00 2001 From: tobias Date: Mon, 11 Aug 2008 17:17:53 +0000 Subject: [PATCH] Prevent a buffer underrun if a line is received which only contains (multiple) @. ok millert, otto --- libexec/fingerd/fingerd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; -- 2.20.1