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

Xin LI delphij at frontfree.net
Mon Jul 5 02:50:43 PDT 2004


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00003.pgp
Type: application/octet-stream
Size: 187 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/submit/attachments/20040705/bf58c150/attachment-0018.obj>


More information about the Submit mailing list