From 01ad46a801b8d06bb042bac1a5a17c217bc8931c Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 27 Jul 2003 18:45:56 +0000 Subject: Correct computation of argsize when setting diffargs. --- usr.bin/diff/diff.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'usr.bin/diff') diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c index 56b11e3da95..0338b7ec00c 100644 --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.35 2003/07/27 07:39:52 otto Exp $ */ +/* $OpenBSD: diff.c,v 1.36 2003/07/27 18:45:55 millert Exp $ */ /* * Copyright (c) 2003 Todd C. Miller @@ -21,7 +21,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: diff.c,v 1.35 2003/07/27 07:39:52 otto Exp $"; +static const char rcsid[] = "$OpenBSD: diff.c,v 1.36 2003/07/27 18:45:55 millert Exp $"; #endif /* not lint */ #include @@ -207,7 +207,7 @@ main(int argc, char **argv) err(2, "%s", argv[1]); if (gotstdin && (S_ISDIR(stb1.st_mode) || S_ISDIR(stb2.st_mode))) errx(2, "can't compare - to a directory"); - set_argstr(oargv, argv); + set_argstr(oargv + 1, argv); if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) errx(2, "-D option not supported with directories"); @@ -270,7 +270,7 @@ set_argstr(char **av, char **ave) size_t argsize; char **ap; - argsize = 4 + (char *)ave - (char *)av + 1; + argsize = 4 + *ave - *av + 1; diffargs = emalloc(argsize); strlcpy(diffargs, "diff", argsize); for (ap = av + 1; ap < ave; ap++) { -- cgit v1.2.3