OSDN Git Service

msm: adsprpc: Fix memory out of bounds error
authorMohammed Nayeem Ur Rahman <mohara@codeaurora.org>
Wed, 10 Oct 2018 11:04:37 +0000 (16:34 +0530)
committerGerrit - the friendly Code Review server <code-review@localhost>
Tue, 8 Jan 2019 12:48:11 +0000 (04:48 -0800)
Fixes memory out of bound error.

Change-Id: I9cc11b5231ba3654588eadf7a7adca68aff35684
Signed-off-by: Mohammed Nayeem Ur Rahman <mohara@codeaurora.org>
drivers/char/adsprpc.c

index 3da8f64..b042a3d 100644 (file)
@@ -2931,7 +2931,7 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp)
        if (err)
                return err;
        snprintf(strpid, PID_SIZE, "%d", current->pid);
-       buf_size = strlen(current->comm) + strlen(strpid) + 1;
+       buf_size = strlen(current->comm) + strlen("_") + strlen(strpid) + 1;
        fl->debug_buf = kzalloc(buf_size, GFP_KERNEL);
        snprintf(fl->debug_buf, UL_SIZE, "%.10s%s%d",
        current->comm, "_", current->pid);