[U-Boot] [PATCH 2/2] qe: use strncpy instead of strcpy

Michael Trimarchi michael at amarulasolutions.com
Tue May 5 10:32:56 CEST 2015


Hi

On Tue, May 5, 2015 at 3:53 PM, Zhao Qiang <B45475 at freescale.com> wrote:
> strncpy is safer than strcpy, use it to instead of strcpy.
>
> Signed-off-by: Zhao Qiang <B45475 at freescale.com>
> ---
>  drivers/qe/qe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/qe/qe.c b/drivers/qe/qe.c
> index f1df0a4..08620b2 100644
> --- a/drivers/qe/qe.c
> +++ b/drivers/qe/qe.c
> @@ -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);

is 62 somenthing that can be calculated?

>         qe_firmware_info.extended_modes = firmware->extended_modes;
>         memcpy(qe_firmware_info.vtraps, firmware->vtraps,
>                 sizeof(firmware->vtraps));
> --
> 2.1.0.27.g96db324
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot


More information about the U-Boot mailing list