Skip to content

Commit

Permalink
fs: dlm: fix potential buffer overflow
Browse files Browse the repository at this point in the history
This patch fixes an potential overflow in sscanf and the maximum
declared string parsing length which seems to be excluding the null
termination symbol. This patch will just add one byte to be prepared on
a string with length of DLM_RESNAME_MAXLEN including the null
termination symbol.

Fixes: 5054e79 ("fs: dlm: add lkb debugfs functionality")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
  • Loading branch information
Alexander Aring authored and David Teigland committed Nov 12, 2021
1 parent c8b9f34 commit 6a628fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/dlm/debug_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ static ssize_t table_write2(struct file *file, const char __user *user_buf,
{
struct seq_file *seq = file->private_data;
int n, len, lkb_nodeid, lkb_status, error;
char name[DLM_RESNAME_MAXLEN] = {};
char name[DLM_RESNAME_MAXLEN + 1] = {};
struct dlm_ls *ls = seq->private;
unsigned int lkb_flags;
char buf[256] = {};
Expand Down

0 comments on commit 6a628fa

Please sign in to comment.