projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c02e3f3
)
dac960: fix undefined behavior on empty string
author
Michael Buesch
<
[email protected]
>
Tue, 22 Sep 2009 23:43:36 +0000
(16:43 -0700)
committer
Linus Torvalds
<
[email protected]
>
Wed, 23 Sep 2009 14:39:28 +0000
(07:39 -0700)
Fix undefined behavior due to a buffer underrun if an empty string is
written to the proc file.
Signed-off-by: Michael Buesch <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
drivers/block/DAC960.c
patch
|
blob
|
history
diff --git
a/drivers/block/DAC960.c
b/drivers/block/DAC960.c
index c77b6f3c28ea47e16580e43d6f63a538c5e56bfe..6fa7b0fdbdfd172f2e10f27bc82660c9201f3234 100644
(file)
--- a/
drivers/block/DAC960.c
+++ b/
drivers/block/DAC960.c
@@
-6562,7
+6562,7
@@
static int DAC960_ProcWriteUserCommand(struct file *file,
if (copy_from_user(CommandBuffer, Buffer, Count)) return -EFAULT;
CommandBuffer[Count] = '\0';
Length = strlen(CommandBuffer);
- if (CommandBuffer[Length-1] == '\n')
+ if (
Length > 0 &&
CommandBuffer[Length-1] == '\n')
CommandBuffer[--Length] = '\0';
if (Controller->FirmwareType == DAC960_V1_Controller)
return (DAC960_V1_ExecuteUserCommand(Controller, CommandBuffer)