mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-26 06:03:20 -05:00
[library] RSS - protect against invalid pubdate
This commit is contained in:
parent
b00e2655f0
commit
f23ef1aa9c
@ -84,15 +84,19 @@ rss_date(struct tm *tm, const char *date)
|
|||||||
// optional ^^^^^
|
// optional ^^^^^
|
||||||
// could also be GMT/UT/EST/A..I/M..Z
|
// could also be GMT/UT/EST/A..I/M..Z
|
||||||
|
|
||||||
const char *ptr;
|
const char *ptr = NULL;
|
||||||
time_t t;
|
time_t t;
|
||||||
|
|
||||||
memset(tm, 0, sizeof(struct tm));
|
memset(tm, 0, sizeof(struct tm));
|
||||||
ptr = strptime(date, "%a,%n", tm); // Looks for optional day of week
|
if (date)
|
||||||
if (!ptr)
|
{
|
||||||
ptr = date;
|
ptr = strptime(date, "%a,%n", tm); // Looks for optional day of week
|
||||||
|
if (!ptr)
|
||||||
|
ptr = date;
|
||||||
|
|
||||||
|
ptr = strptime(ptr, "%d%n%b%n%Y%n%H:%M:%S%n", tm);
|
||||||
|
}
|
||||||
|
|
||||||
ptr = strptime(ptr, "%d%n%b%n%Y%n%H:%M:%S%n", tm);
|
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
{
|
{
|
||||||
// date is junk, using current time
|
// date is junk, using current time
|
||||||
@ -345,9 +349,14 @@ rss_xml_parse_item(struct rss_item_info *ri, mxml_node_t *xml, void **saveptr)
|
|||||||
ri->url = mxmlElementGetAttr(node, "url");
|
ri->url = mxmlElementGetAttr(node, "url");
|
||||||
ri->type = mxmlElementGetAttr(node, "type");
|
ri->type = mxmlElementGetAttr(node, "type");
|
||||||
|
|
||||||
|
DPRINTF(E_DBG, L_LIB, "RSS/xml item: title '%s' pubdate: '%s' link: '%s' url: '%s' type: '%s'\n", ri->title, ri->pubdate, ri->link, ri->url, ri->type);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The RSS spec states:
|
||||||
|
// Elements of <item>
|
||||||
|
// .... All elements of an item are optional, however at least one of title or description must be present
|
||||||
static void
|
static void
|
||||||
mfi_metadata_fixup(struct media_file_info *mfi, struct rss_item_info *ri, const char *feed_title, const char *feed_author, uint32_t time_added)
|
mfi_metadata_fixup(struct media_file_info *mfi, struct rss_item_info *ri, const char *feed_title, const char *feed_author, uint32_t time_added)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user