staging: tidspbridge/pmgr: another using strlcpy instead of strncpy
authorChen Gang <gang.chen@asianux.com>
Mon, 21 Jan 2013 09:36:33 +0000 (17:36 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Jan 2013 22:00:10 +0000 (14:00 -0800)
  The fields must be null-terminated,
  or next strstr in dcd_get_objects, will cause issue

additoinal info:
  nldr_create may call cod_get_base_name, let sz_zl_file to get name (sz_name)
  and then call dcd_get_objects, passing sz_zl_file as a name string.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Cc: Omar Ramirez Luna <omar.ramirez@copitl.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/tidspbridge/pmgr/cod.c

index 4007826f7abc5db50041d86ed0d03a9eb0fec996..6c29379baf60d2242a9a810b21b8c843136afe6f 100644 (file)
@@ -289,7 +289,7 @@ int cod_get_base_name(struct cod_manager *cod_mgr_obj, char *sz_name,
        int status = 0;
 
        if (usize <= COD_MAXPATHLENGTH)
-               strncpy(sz_name, cod_mgr_obj->sz_zl_file, usize);
+               strlcpy(sz_name, cod_mgr_obj->sz_zl_file, usize);
        else
                status = -EPERM;