Mercurial > mplayer.hg
comparison libvo/vo_bl.c @ 36504:edc2020f7bf4
vo_bl: Use snprintf.
author | reimar |
---|---|
date | Sat, 18 Jan 2014 13:05:50 +0000 |
parents | 2545bbe7d845 |
children | 294261f7e1b5 |
comparison
equal
deleted
inserted
replaced
36503:2545bbe7d845 | 36504:edc2020f7bf4 |
---|---|
364 if (!strncmp(p, bls[i].name, strlen(bls[i].name))) | 364 if (!strncmp(p, bls[i].name, strlen(bls[i].name))) |
365 break; | 365 break; |
366 } | 366 } |
367 if (i >= NO_BLS) { | 367 if (i >= NO_BLS) { |
368 txt[0] = 0; | 368 txt[0] = 0; |
369 for (i = 0; i < NO_BLS; i++) | 369 for (i = 0; i < NO_BLS; i++) { |
370 if (strlen( txt ) + 4 + strlen( bls[i].name ) + 1 < sizeof(txt)) | 370 int pos = strlen(txt); |
371 sprintf( txt + strlen( txt ), "%s%s", | 371 snprintf(txt + pos, sizeof(txt) - pos, "%s%s", |
372 txt[0] == 0 ? "" : i == NO_BLS - 1 ? " or " : ", ", bls[i].name ); | 372 txt[0] == 0 ? "" : i == NO_BLS - 1 ? " or " : ", ", bls[i].name ); |
373 } | |
373 mp_msg(MSGT_VO, MSGL_ERR, "bl: subdevice must start with %s\nbl: i.e. -vo bl:arcade:host=localhost:2323\n", txt); | 374 mp_msg(MSGT_VO, MSGL_ERR, "bl: subdevice must start with %s\nbl: i.e. -vo bl:arcade:host=localhost:2323\n", txt); |
374 return 1; | 375 return 1; |
375 } | 376 } |
376 // Global data arrays should not be modified, otherwise behaviour | 377 // Global data arrays should not be modified, otherwise behaviour |
377 // becomes too confusing. | 378 // becomes too confusing. |