[alsa-devel] [PATCH 4/9] ALSA: compress: use snprint instread of sprintf

Vinod Koul vinod.koul at intel.com
Tue Aug 27 08:40:34 CEST 2013


To prevent possiblity of exceeding buffer size

Signed-off-by: Vinod Koul <vinod.koul at intel.com>
---
 sound/core/compress_offload.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index e640f8c..1e722c2 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -871,7 +871,7 @@ static int snd_compress_dev_register(struct snd_device *device)
 		return -EBADFD;
 	compr = device->device_data;
 
-	sprintf(str, "comprC%iD%i", compr->card->number, compr->device);
+	snprintf(str, sizeof(str), "comprC%iD%i", compr->card->number, compr->device);
 	pr_debug("reg %s for device %s, direction %d\n", str, compr->name,
 			compr->direction);
 	/* register compressed device */
-- 
1.7.0.4



More information about the Alsa-devel mailing list