sysprog21 / vwifi

A virtual wireless device driver for Linux
MIT License
203 stars 39 forks source link

Correct the used of snprintf in owinterface_add #51

Closed vax-r closed 10 months ago

vax-r commented 10 months ago

The origin size value in snprintf of owinterface_add was ETH_ALEN, which will only allow ETH_ALEN - 1 characters to write in the buffer when string size is too long.

However, since the buffer starts from inf_name + 1, which only allow ETH_ALEN - 1 characters to be written into, plus the last character must be '\0', so we should only allow ETH_ALEN - 2 character to be written into the buffer.

That's why I create the PR and fix the size value to ETH_ALEN - 1

vax-r commented 10 months ago

Read the article How to Write a Git Commit Message and rewrite your git commit messages.

I've made some modification to my commit message, please take a look when you have available time. Thanks

jserv commented 10 months ago

Thank @vax-r for contributing!