Skip to content

Commit

Permalink
net: ethernet: myricom: myri10ge: myri10ge.c: Cleaning up missing nul…
Browse files Browse the repository at this point in the history
…l-terminate after strncpy call

Added a guaranteed null-terminate after call to strncpy.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Rickard Strandqvist authored and David S. Miller committed Aug 11, 2014
1 parent 97a6d1b commit 8dff81e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/ethernet/myricom/myri10ge/myri10ge.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ myri10ge_validate_firmware(struct myri10ge_priv *mgp,

/* save firmware version for ethtool */
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,
&mgp->fw_ver_minor, &mgp->fw_ver_tiny);
Expand Down

0 comments on commit 8dff81e

Please sign in to comment.