Skip to content

Commit 8115692

Browse files
Pavel Roskintorvalds
authored andcommitted
dell_rbu: use scnprintf() instead of less secure sprintf()
Reading 0 bytes from /sys/devices/platform/dell_rbu/image_type or /sys/devices/platform/dell_rbu/packet_size by an ordinary user causes an oops. Signed-off-by: Pavel Roskin <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 0d54ee1 commit 8115692

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/firmware/dell_rbu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ static ssize_t read_rbu_image_type(struct kobject *kobj,
576576
{
577577
int size = 0;
578578
if (!pos)
579-
size = sprintf(buffer, "%s\n", image_type);
579+
size = scnprintf(buffer, count, "%s\n", image_type);
580580
return size;
581581
}
582582

@@ -648,7 +648,7 @@ static ssize_t read_rbu_packet_size(struct kobject *kobj,
648648
int size = 0;
649649
if (!pos) {
650650
spin_lock(&rbu_data.lock);
651-
size = sprintf(buffer, "%lu\n", rbu_data.packetsize);
651+
size = scnprintf(buffer, count, "%lu\n", rbu_data.packetsize);
652652
spin_unlock(&rbu_data.lock);
653653
}
654654
return size;

0 commit comments

Comments
 (0)