Re: [OpenWrt-Devel] [PATCH] [netifd] vlan: Array out of bounds in snprintf for vlans

2018-02-01 Thread Daniel F. Dickinson
On 01/02/18 02:29 AM, Daniel F. Dickinson wrote: On 31/01/18 06:20 AM, Paul Oranje wrote: Why use a hard coded value 4 in "snprintf(devnum, 4, "%d", vldev->id);" ? Paul Oh I see this also the uglier first throw-together; there is a v2 that isn't as bad (and is actually right; this version

Re: [OpenWrt-Devel] [PATCH] [netifd] vlan: Array out of bounds in snprintf for vlans

2018-01-31 Thread Daniel F. Dickinson
On 31/01/18 06:20 AM, Paul Oranje wrote: Why use a hard coded value 4 in "snprintf(devnum, 4, "%d", vldev->id);" ? Paul Max value for a VLAN id is 4095 = 4 digits, although probably better would be to accept full length for int and truncate in the next line. That and this was a quick hack

Re: [OpenWrt-Devel] [PATCH] [netifd] vlan: Array out of bounds in snprintf for vlans

2018-01-31 Thread Paul Oranje
Why use a hard coded value 4 in "snprintf(devnum, 4, "%d", vldev->id);" ? Paul > Op 30 jan. 2018, om 19:16 heeft csho...@thecshore.com het volgende geschreven: > > From: "Daniel F. Dickinson" > > Detected during a side project. Not a brilliant fix, but it > gets the job

Re: [OpenWrt-Devel] [PATCH] [netifd] vlan: Array out of bounds in snprintf for vlans

2018-01-30 Thread Daniel F. Dickinson
On 30/01/18 01:16 PM, csho...@thecshore.com wrote: From: "Daniel F. Dickinson" Detected during a side project. Not a brilliant fix, but it gets the job done for now. *very* lightly tested, more for your information than anything else. Dammit, made an off-by-one in

[OpenWrt-Devel] [PATCH] [netifd] vlan: Array out of bounds in snprintf for vlans

2018-01-30 Thread cshored
From: "Daniel F. Dickinson" Detected during a side project. Not a brilliant fix, but it gets the job done for now. *very* lightly tested, more for your information than anything else. Array out-of-bounds condition can occur because vlan device name is constructed from