changeset 30938:304b762b62cb

Sanitize ICY metadata a bit before printing it.
author reimar
date Wed, 31 Mar 2010 19:42:15 +0000
parents f87bfe2885f2
children 1eb76f19daae
files stream/http.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stream/http.c	Wed Mar 31 18:45:00 2010 +0000
+++ b/stream/http.c	Wed Mar 31 19:42:15 2010 +0000
@@ -124,8 +124,13 @@
   my_read(fd, &tmp, 1, sc);
   metalen = tmp * 16;
   if (metalen > 0) {
+    int i;
     char *info = malloc(metalen + 1);
     unsigned nlen = my_read(fd, info, metalen, sc);
+    // avoid breaking the user's terminal too much
+    if (nlen > 256) nlen = 256;
+    for (i = 0; i < nlen; i++)
+      if (info[i] && info[i] < 32) info[i] = '?';
     info[nlen] = 0;
     mp_msg(MSGT_DEMUXER, MSGL_INFO, "\nICY Info: %s\n", info);
     free(info);