Skip to content

Fix converting zero-terminated string to Go string#40

Merged
safchain merged 1 commit intosafchain:masterfrom
bdrung:c-string
Oct 27, 2021
Merged

Fix converting zero-terminated string to Go string#40
safchain merged 1 commit intosafchain:masterfrom
bdrung:c-string

Conversation

@bdrung
Copy link
Contributor

@bdrung bdrung commented Jul 15, 2021

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: #39

@bdrung bdrung force-pushed the c-string branch 2 times, most recently from 8728c74 to 10a59c5 Compare July 15, 2021 14:23
@bdrung
Copy link
Contributor Author

bdrung commented Jul 15, 2021

Added test cases for it.

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: safchain#39
Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
@safchain safchain merged commit 00502cf into safchain:master Oct 27, 2021
@bdrung bdrung deleted the c-string branch October 27, 2021 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DriverInfo.Version contains NULL followed by garbage

2 participants