summaryrefslogtreecommitdiffstats
path: root/usr.bin/rcs/rcs.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
committerderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
commitb9fc9a728fce9c4289b7e9a992665e28d5629a54 (patch)
tree72b2433e418dfa1aef5fcf8305617b97979a25d8 /usr.bin/rcs/rcs.c
parentimprove checksum parsing slightly. now handles filenames with spaces. (diff)
downloadwireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.tar.xz
wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.zip
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'usr.bin/rcs/rcs.c')
-rw-r--r--usr.bin/rcs/rcs.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c
index cd86d6991a9..4db755e0cdc 100644
--- a/usr.bin/rcs/rcs.c
+++ b/usr.bin/rcs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.81 2014/10/10 08:15:25 otto Exp $ */
+/* $OpenBSD: rcs.c,v 1.82 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -24,6 +24,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/param.h> /* MAXBSIZE */
#include <sys/stat.h>
#include <ctype.h>
@@ -44,6 +45,8 @@
#include "rcsutil.h"
#include "xmalloc.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
/* invalid characters in RCS states */
static const char rcs_state_invch[] = RCS_STATE_INVALCHAR;
@@ -981,7 +984,7 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev)
/* XXX rcsnum_cmp() is totally broken for
* this purpose.
*/
- numlen = MIN(brev->rn_len,
+ numlen = MINIMUM(brev->rn_len,
rb->rb_num->rn_len - 1);
for (i = 0; i < numlen; i++) {
if (rb->rb_num->rn_id[i] !=
@@ -1477,7 +1480,7 @@ rcs_expand_keywords(char *rcsfile_in, struct rcs_delta *rdp, BUF *bp, int mode)
{
BUF *newbuf;
u_char *c, *kw, *fin;
- char buf[256], *tmpf, resolved[MAXPATHLEN], *rcsfile;
+ char buf[256], *tmpf, resolved[PATH_MAX], *rcsfile;
u_char *line, *line2;
u_int i, j;
int kwtype;