diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2010-07-30 21:47:19 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2010-07-30 21:47:19 +0000 |
commit | 5b4d08115158f975fd068894b5cfad09175bc414 (patch) | |
tree | 3e47af1712c2cd497d780fd8cee57455d23222fe /usr.bin/rcs/co.c | |
parent | a3cf3598f3d68ae8538b4a7479b9286ace167aae (diff) |
Check date_parse return values.
OK xsa
Diffstat (limited to 'usr.bin/rcs/co.c')
-rw-r--r-- | usr.bin/rcs/co.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/rcs/co.c b/usr.bin/rcs/co.c index 90c9e14ceca..a6860d021b2 100644 --- a/usr.bin/rcs/co.c +++ b/usr.bin/rcs/co.c @@ -1,4 +1,4 @@ -/* $OpenBSD: co.c,v 1.112 2010/07/28 09:07:11 ray Exp $ */ +/* $OpenBSD: co.c,v 1.113 2010/07/30 21:47:18 ray Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -261,8 +261,10 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags, RCSNUM *rev; rcsdate = givendate = -1; - if (date != NULL) - givendate = date_parse(date); + if (date != NULL && (givendate = date_parse(date)) == -1) { + warnx("invalid date: %s", date); + return -1; + } if (file->rf_ndelta == 0 && !(flags & QUIET)) (void)fprintf(stderr, @@ -303,7 +305,10 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags, TAILQ_FOREACH(rdp, &file->rf_delta, rd_list) { if (date != NULL) { fdate = asctime(&rdp->rd_date); - rcsdate = date_parse(fdate); + if ((rcsdate = date_parse(fdate)) == -1) { + warnx("invalid date: %s", fdate); + return -1; + } if (givendate <= rcsdate) continue; } |