changeset 36504:edc2020f7bf4

vo_bl: Use snprintf.
author reimar
date Sat, 18 Jan 2014 13:05:50 +0000
parents 2545bbe7d845
children 294261f7e1b5
files libvo/vo_bl.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_bl.c	Sat Jan 18 12:59:25 2014 +0000
+++ b/libvo/vo_bl.c	Sat Jan 18 13:05:50 2014 +0000
@@ -366,10 +366,11 @@
 	}
 	if (i >= NO_BLS) {
 		txt[0] = 0;
-		for (i = 0; i < NO_BLS; i++)
-			if (strlen( txt ) + 4 + strlen( bls[i].name ) + 1 < sizeof(txt))
-				sprintf( txt + strlen( txt ), "%s%s",
+		for (i = 0; i < NO_BLS; i++) {
+			int pos = strlen(txt);
+			snprintf(txt + pos, sizeof(txt) - pos, "%s%s",
 					 txt[0] == 0 ? "" : i == NO_BLS - 1 ? " or " : ", ", bls[i].name );
+		}
 		mp_msg(MSGT_VO, MSGL_ERR, "bl: subdevice must start with %s\nbl: i.e. -vo bl:arcade:host=localhost:2323\n", txt);
 		return 1;
 	}