driver/qe: use strncpy instead of strcpy
authorZhao Qiang <B45475@freescale.com>
Tue, 5 May 2015 07:53:33 +0000 (15:53 +0800)
committerYork Sun <yorksun@freescale.com>
Mon, 3 Aug 2015 19:06:36 +0000 (12:06 -0700)
strncpy is safer than strcpy, use it to instead of strcpy.

Signed-off-by: Zhao Qiang <B45475@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>
drivers/qe/qe.c

index f1df0a419ca206f4b0e626669214b813692da758..08620b23a7180fba914626b471a9de5ed099b90a 100644 (file)
@@ -435,7 +435,7 @@ int qe_upload_firmware(const struct qe_firmware *firmware)
         * saved microcode information and put in the new.
         */
        memset(&qe_firmware_info, 0, sizeof(qe_firmware_info));
-       strcpy(qe_firmware_info.id, (char *)firmware->id);
+       strncpy(qe_firmware_info.id, (char *)firmware->id, 62);
        qe_firmware_info.extended_modes = firmware->extended_modes;
        memcpy(qe_firmware_info.vtraps, firmware->vtraps,
                sizeof(firmware->vtraps));