Commit 8dff81e8 authored by Rickard Strandqvist's avatar Rickard Strandqvist Committed by David S. Miller

net: ethernet: myricom: myri10ge: myri10ge.c: Cleaning up missing null-terminate after strncpy call

Added a guaranteed null-terminate after call to strncpy.
Signed-off-by: default avatarRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 97a6d1bb
...@@ -574,6 +574,7 @@ myri10ge_validate_firmware(struct myri10ge_priv *mgp, ...@@ -574,6 +574,7 @@ myri10ge_validate_firmware(struct myri10ge_priv *mgp,
/* save firmware version for ethtool */ /* save firmware version for ethtool */
strncpy(mgp->fw_version, hdr->version, sizeof(mgp->fw_version)); strncpy(mgp->fw_version, hdr->version, sizeof(mgp->fw_version));
mgp->fw_version[sizeof(mgp->fw_version) - 1] = '\0';
sscanf(mgp->fw_version, "%d.%d.%d", &mgp->fw_ver_major, sscanf(mgp->fw_version, "%d.%d.%d", &mgp->fw_ver_major,
&mgp->fw_ver_minor, &mgp->fw_ver_tiny); &mgp->fw_ver_minor, &mgp->fw_ver_tiny);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment