Skip to content

Commit

Permalink
[IA64] Handle count==0 in sn2_ptc_proc_write()
Browse files Browse the repository at this point in the history
The fix applied in e0c6d97
"security hole in sn2_ptc_proc_write" didn't take into account
the case where count==0 (which results in a buffer underrun
when adding the trailing '\0').  Thanks to Andi Kleen for
pointing this out.

Signed-off-by: Cliff Wickman <[email protected]>
Signed-off-by: Tony Luck <[email protected]>
  • Loading branch information
cpwickman authored and aegl committed Jun 24, 2008
1 parent 2826f8c commit 8097110
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/ia64/sn/kernel/sn2/sn2_smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ static ssize_t sn2_ptc_proc_write(struct file *file, const char __user *user, si
int cpu;
char optstr[64];

if (count > sizeof(optstr))
if (count == 0 || count > sizeof(optstr))
return -EINVAL;
if (copy_from_user(optstr, user, count))
return -EFAULT;
Expand Down

0 comments on commit 8097110

Please sign in to comment.