From 6c0396ba2ab4bf10535ef43c486c1836786fc97e Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 5 May 2004 19:39:21 +0000 Subject: Steve Grubb writes: Hi, I just re-reviewed the patch I just sent...and it needed to be BUFSIZ-3 in dos2unix.c . tempFn is BUFSIZ so the last addressable spot it BUFSIZ-1. The loop increments by 2. That's why it should be BUFSIZ-3. Best Regards, Steve Grubb --- coreutils/dos2unix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'coreutils/dos2unix.c') diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c index c8cebcec7..df0b4f977 100644 --- a/coreutils/dos2unix.c +++ b/coreutils/dos2unix.c @@ -64,7 +64,9 @@ static int convert(char *fn, int ConvType) c = strlen(tempFn); tempFn[c] = '.'; while(1) { - if (c >=BUFSIZ-2) + /* tempFn is BUFSIZ so the last addressable spot it BUFSIZ-1. + * The loop increments by 2. So this must check for BUFSIZ-3. */ + if (c >=BUFSIZ-3) bb_error_msg_and_die("unique name not found"); /* Get some semi random stuff to try and make a * random filename based (and in the same dir as) -- cgit v1.2.3