Skip to contentSkip to conversation

radio: NUL terminate a user string

PATCH New Dan Carpenter 1 participant 1 message Nov 23, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 radio: NUL terminate a user string

We pass this to fm_tx_set_radio_text() which expects a NUL terminated string.

drivers/media/radio/wl128x/fmdrv_v4l2.c +1 -0
index 4f5c43d..077d369 100644
@@ -84,6 +84,7 @@ static ssize_t fm_v4l2_fops_write(struct file *file, const char __user * buf,
 	struct fmdev *fmdev;
 
 	ret = copy_from_user(&rds, buf, sizeof(rds));
+	rds.text[sizeof(rds.text) - 1] = '\0';
 	fmdbg("(%d)type: %d, text %s, af %d\n",
 		   ret, rds.text_type, rds.text, rds.af_freq);
 	if (ret)