tracing/uprobe_event: Fix strncpy corner case
[platform/kernel/linux-rpi.git] / kernel / trace / trace_uprobe.c
index 14d3af6..7197ff9 100644 (file)
@@ -152,6 +152,8 @@ static void FETCH_FUNC_NAME(memory, string)(struct pt_regs *regs,
                return;
 
        ret = strncpy_from_user(dst, src, maxlen);
+       if (ret == maxlen)
+               dst[--ret] = '\0';
 
        if (ret < 0) {  /* Failed to fetch string */
                ((u8 *)get_rloc_data(dest))[0] = '\0';