comparison stream/http.c @ 30938:304b762b62cb

Sanitize ICY metadata a bit before printing it.
author reimar
date Wed, 31 Mar 2010 19:42:15 +0000
parents 9fc9d1e788aa
children fb3bde3ec3a8
comparison
equal deleted inserted replaced
30937:f87bfe2885f2 30938:304b762b62cb
122 unsigned char tmp = 0; 122 unsigned char tmp = 0;
123 unsigned metalen; 123 unsigned metalen;
124 my_read(fd, &tmp, 1, sc); 124 my_read(fd, &tmp, 1, sc);
125 metalen = tmp * 16; 125 metalen = tmp * 16;
126 if (metalen > 0) { 126 if (metalen > 0) {
127 int i;
127 char *info = malloc(metalen + 1); 128 char *info = malloc(metalen + 1);
128 unsigned nlen = my_read(fd, info, metalen, sc); 129 unsigned nlen = my_read(fd, info, metalen, sc);
130 // avoid breaking the user's terminal too much
131 if (nlen > 256) nlen = 256;
132 for (i = 0; i < nlen; i++)
133 if (info[i] && info[i] < 32) info[i] = '?';
129 info[nlen] = 0; 134 info[nlen] = 0;
130 mp_msg(MSGT_DEMUXER, MSGL_INFO, "\nICY Info: %s\n", info); 135 mp_msg(MSGT_DEMUXER, MSGL_INFO, "\nICY Info: %s\n", info);
131 free(info); 136 free(info);
132 } 137 }
133 } 138 }