output/httpd/IcyMetaDataServer: use CopyString() instead of g_strlcpy()
This commit is contained in:
parent
15213a041d
commit
7363d50a1e
@ -348,8 +348,6 @@ AC_ARG_ENABLE(httpd-output,
|
|||||||
AS_HELP_STRING([--enable-httpd-output],
|
AS_HELP_STRING([--enable-httpd-output],
|
||||||
[enables the HTTP server output]),,
|
[enables the HTTP server output]),,
|
||||||
[enable_httpd_output=auto])
|
[enable_httpd_output=auto])
|
||||||
MPD_DEPENDS([enable_httpd_output], [enable_glib],
|
|
||||||
[Cannot use --enable-httpd-output with --disable-glib])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(inotify,
|
AC_ARG_ENABLE(inotify,
|
||||||
AS_HELP_STRING([--disable-inotify],
|
AS_HELP_STRING([--disable-inotify],
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
#include "Page.hxx"
|
#include "Page.hxx"
|
||||||
#include "tag/Tag.hxx"
|
#include "tag/Tag.hxx"
|
||||||
#include "util/FormatString.hxx"
|
#include "util/FormatString.hxx"
|
||||||
|
#include "util/StringUtil.hxx"
|
||||||
#include <glib.h>
|
#include "util/Macros.hxx"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -95,25 +95,14 @@ icy_server_metadata_page(const Tag &tag, const TagType *types)
|
|||||||
|
|
||||||
// Length + Metadata - "StreamTitle='';StreamUrl='';" = 4081 - 28
|
// Length + Metadata - "StreamTitle='';StreamUrl='';" = 4081 - 28
|
||||||
char stream_title[(1 + 255 - 28) * 16];
|
char stream_title[(1 + 255 - 28) * 16];
|
||||||
|
char *p = stream_title, *const end = stream_title + ARRAY_SIZE(stream_title);
|
||||||
stream_title[0] = '\0';
|
stream_title[0] = '\0';
|
||||||
unsigned position = 0;
|
|
||||||
|
|
||||||
while (position < sizeof(stream_title) && item <= last_item) {
|
while (p < end && item <= last_item) {
|
||||||
size_t length = 0;
|
p = CopyString(p, tag_items[item++], end - p);
|
||||||
|
|
||||||
length = g_strlcpy(stream_title + position,
|
if (item <= last_item)
|
||||||
tag_items[item++],
|
p = CopyString(p, " - ", end - p);
|
||||||
sizeof(stream_title) - position);
|
|
||||||
|
|
||||||
position += length;
|
|
||||||
|
|
||||||
if (item <= last_item) {
|
|
||||||
length = g_strlcpy(stream_title + position,
|
|
||||||
" - ",
|
|
||||||
sizeof(stream_title) - position);
|
|
||||||
|
|
||||||
position += length;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *icy_string = icy_server_metadata_string(stream_title, "");
|
char *icy_string = icy_server_metadata_string(stream_title, "");
|
||||||
|
Loading…
Reference in New Issue
Block a user