net: ethernet: myricom: myri10ge: myri10ge.c: Cleaning up missing null-terminate...
authorRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Mon, 11 Aug 2014 19:18:16 +0000 (21:18 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 Aug 2014 21:47:22 +0000 (14:47 -0700)
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>
drivers/net/ethernet/myricom/myri10ge/myri10ge.c

index f3d5d79f1cd15de8dff66fa4aeab6fccaa25ab8e..69c26f04d8ce06aa0b74b944e12ed282e618e7fb 100644 (file)
@@ -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);