diff options
| author | Ivan Delalande <colona@ycc.fr> | 2014-12-12 08:39:07 +0100 |
|---|---|---|
| committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2014-12-23 16:20:59 +0100 |
| commit | 708b697ed77e1ba4e96399ed6cb0f73a37565321 (patch) | |
| tree | 3d236db07cbed0967a03998980ba0309a050894c | |
| parent | 09f5d98251469070b76f3911cc6a83d977871656 (diff) | |
| download | st-708b697ed77e1ba4e96399ed6cb0f73a37565321.tar.gz st-708b697ed77e1ba4e96399ed6cb0f73a37565321.zip | |
Fix crash due to invalid timespec given to pselect
If blinktimeout is set to a value greater than 1000, pselect will
receive a timeout argument with tv_nsec greater than 1E9 (1 sec), and
fail, making st crash. This patch just ensures that the timespec
structure is correctly filled with a value properly decomposed between
tv_sec and tv_nsec.
Reported by JasonWoof on IRC. Thanks!
| -rw-r--r-- | st.c | 3 |
1 files changed, 3 insertions, 0 deletions
| @@ -3922,6 +3922,9 @@ run(void) { | |||
| 3922 | TIMEDIFF(now, | 3922 | TIMEDIFF(now, |
| 3923 | lastblink))); | 3923 | lastblink))); |
| 3924 | } | 3924 | } |
| 3925 | drawtimeout.tv_sec = \ | ||
| 3926 | drawtimeout.tv_nsec / 1E9; | ||
| 3927 | drawtimeout.tv_nsec %= (long)1E9; | ||
| 3925 | } else { | 3928 | } else { |
| 3926 | tv = NULL; | 3929 | tv = NULL; |
| 3927 | } | 3930 | } |
