hostapd: normalize microsecond limit when parsing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

hostapd: normalize microsecond limit when parsing

Scott Cheloha
Hi,

I'm unfamiliar with this code, but assigning the microsecond value
without normalizing it for the timeval looks off.

--
Scott Cheloha

Index: usr.sbin/hostapd/parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/hostapd/parse.y,v
retrieving revision 1.53
diff -u -p -r1.53 parse.y
--- usr.sbin/hostapd/parse.y 5 Jan 2017 13:53:09 -0000 1.53
+++ usr.sbin/hostapd/parse.y 7 Feb 2018 22:12:17 -0000
@@ -500,7 +500,8 @@ limit : /* empty */
  yyerror("limit out of range: %lld usec", $2);
  YYERROR;
  }
- frame.f_limit.tv_usec = $2;
+ frame.f_limit.tv_sec = $2 / 1000000;
+ frame.f_limit.tv_usec = $2 % 1000000;
  }
  ;
 

Reply | Threaded
Open this post in threaded view
|

Re: hostapd: normalize microsecond limit when parsing

Todd C. Miller-2
On Mon, 12 Feb 2018 10:08:25 -0600, Scott Cheloha wrote:

> I'm unfamiliar with this code, but assigning the microsecond value
> without normalizing it for the timeval looks off.

That makes sense.  There's nothing preventing the user from using
values > 1000000.  OK millert@

 - todd