diagnose bogus time units
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Thu, 9 Mar 1995 09:20:14 +0000 (01:20 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Thu, 9 Mar 1995 09:20:14 +0000 (01:20 -0800)
SCCS-vsn: usr.sbin/sendmail/src/convtime.c 8.2

usr/src/usr.sbin/sendmail/src/convtime.c

index 3bae68d..b8bbf88 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)convtime.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)convtime.c 8.2 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <ctype.h>
 #endif /* not lint */
 
 # include <ctype.h>
@@ -55,6 +55,11 @@ convtime(p, units)
                        c = units;
                        p--;
                }
                        c = units;
                        p--;
                }
+               else if (strchr("wdhms", c) == NULL)
+               {
+                       usrerr("Invalid time unit `%c'", c);
+                       c = units;
+               }
                switch (c)
                {
                  case 'w':             /* weeks */
                switch (c)
                {
                  case 'w':             /* weeks */