ash:[patch] do not accept neg values for timeout

walter harms wharms at bfs.de
Wed Sep 6 17:00:08 UTC 2006


hi list,
while running bash test scripts against ash i found that ash accepts
stuff like this:
read -t -3 a < /dev/tty
causing to wait a loooong time

the patch simply catches any neg values and makes it compartibel with sh/bash again.
(maybe someone will try to rewrite the whole timeout stuff with strtof())

re,
 walter

--- shell/ash.c.org     2006-09-06 18:05:41.000000000 +0200
+++ shell/ash.c 2006-09-06 18:16:03.000000000 +0200
@@ -12653,7 +12653,7 @@
                        } else if (*p) {
                                sh_error("invalid timeout");
                        }
-                       if ( ! ts.tv_sec && ! ts.tv_usec)
+                       if ( ( ! ts.tv_sec && ! ts.tv_usec ) || ts.tv_sec < 0 || ts.tv_usec < 0 )
                                sh_error("invalid timeout");
                        break;
 #endif



More information about the busybox mailing list