safchain / ethtool

A simple ethtool "like" library for GO
Apache License 2.0
116 stars 69 forks source link

Fix converting zero-terminated string to Go string #40

Closed bdrung closed 3 years ago

bdrung commented 3 years ago

The version for bridge and tun devices is reported incorrectly. For example, DriverInfo.Version reports 2.3.0-22-generic with a zero character after 2.3. The ethtool -i command reports the version as 2.3.

So strip all characters starting from the zero character.

Fixes: https://github.com/safchain/ethtool/issues/39

bdrung commented 3 years ago

Added test cases for it.