Skip to content

Commit 6bbcf74

Browse files
tiwaistorulf
authored andcommitted
mmc: vub300: Use scnprintf() for avoiding potential buffer overflow
Since snprintf() returns the would-be-output size instead of the actual output size, the succeeding calls may go beyond the given buffer limit. Fix it by replacing with scnprintf(). Signed-off-by: Takashi Iwai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 398b250 commit 6bbcf74

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/mmc/host/vub300.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ static void download_offload_pseudocode(struct vub300_mmc_host *vub300)
13631363
int retval;
13641364
for (n = 0; n < sdio_funcs; n++) {
13651365
struct sdio_func *sf = card->sdio_func[n];
1366-
l += snprintf(vub300->vub_name + l,
1366+
l += scnprintf(vub300->vub_name + l,
13671367
sizeof(vub300->vub_name) - l, "_%04X%04X",
13681368
sf->vendor, sf->device);
13691369
}

0 commit comments

Comments
 (0)