lkml.org 
[lkml]   [2011]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 03/26] dynamic_debug: replace strcpy with strlcpy, in ddebug_setup_query()
    Date
    From: Jim Cromie <jim.cromie@gmail.com>

    replace strcpy with strlcpy, and add define for the size constant.

    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    ---
    lib/dynamic_debug.c | 8 +++++---
    1 files changed, 5 insertions(+), 3 deletions(-)

    diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
    index f2fb0c0..6372b18 100644
    --- a/lib/dynamic_debug.c
    +++ b/lib/dynamic_debug.c
    @@ -516,14 +516,16 @@ EXPORT_SYMBOL(__dynamic_netdev_dbg);

    #endif

    -static __initdata char ddebug_setup_string[1024];
    +#define BOOT_QUERY_SZ 1024
    +static __initdata char ddebug_setup_string[BOOT_QUERY_SZ];
    +
    static __init int ddebug_setup_query(char *str)
    {
    - if (strlen(str) >= 1024) {
    + if (strlen(str) >= BOOT_QUERY_SZ) {
    pr_warn("ddebug boot param string too large\n");
    return 0;
    }
    - strcpy(ddebug_setup_string, str);
    + strlcpy(ddebug_setup_string, str, BOOT_QUERY_SZ);
    return 1;
    }

    --
    1.7.4.4


    \
     
     \ /
      Last update: 2011-09-21 23:59    [W:4.087 / U:0.080 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site