DragonFly BSD
DragonFly submit List (threaded) for 2004-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[PATCH] cron: Fix parsing of '0' and non-alphanumerics in steps


From: Xin LI <delphij@xxxxxxxxxxxxx>
Date: Mon, 5 Jul 2004 17:49:14 +0800

With an entry with "*/0", cron will eat up all CPU, which could be solved with
attached patch. (essentially same as FreeBSD PR/68683)

Obtained from: OpenBSD

Cheers,
-- 
Xin LI <delphij frontfree net>	http://www.delphij.net/
See complete headers for GPG key and other information.

Index: entry.c
===================================================================
RCS file: /home/dcvs/src/usr.sbin/cron/lib/entry.c,v
retrieving revision 1.5
diff -u -r1.5 entry.c
--- entry.c	10 Mar 2004 18:27:28 -0000	1.5
+++ entry.c	5 Jul 2004 09:46:44 -0000
@@ -532,7 +532,7 @@
 		 * sent as a 0 since there is no offset either.
 		 */
 		ch = get_number(&num3, 0, PPC_NULL, ch, file);
-		if (ch == EOF)
+		if (ch == EOF || num3 == 0)
 			return EOF;
 	} else {
 		/* no step.  default==1.
@@ -582,6 +582,8 @@
 		ch = get_char(file);
 	}
 	*pc = '\0';
+	if (len == 0)
+	    return (EOF);
 
 	/* try to find the name in the name list
 	 */

Attachment: pgp00003.pgp
Description: PGP signature



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]