upnpsoap: Error out earlier on certain SQLi attempts
This commit is contained in:
parent
5df410a53d
commit
c7a1c900ab
11
upnpsoap.c
11
upnpsoap.c
@ -813,7 +813,7 @@ get_child_count(const char *object, struct magic_container_s *magic)
|
|||||||
else if (magic && magic->objectid && *(magic->objectid))
|
else if (magic && magic->objectid && *(magic->objectid))
|
||||||
ret = sql_get_int_field(db, "SELECT count(*) from OBJECTS where PARENT_ID = '%s';", *(magic->objectid));
|
ret = sql_get_int_field(db, "SELECT count(*) from OBJECTS where PARENT_ID = '%s';", *(magic->objectid));
|
||||||
else
|
else
|
||||||
ret = sql_get_int_field(db, "SELECT count(*) from OBJECTS where PARENT_ID = '%s';", object);
|
ret = sql_get_int_field(db, "SELECT count(*) from OBJECTS where PARENT_ID = '%q';", object);
|
||||||
|
|
||||||
return (ret > 0) ? ret : 0;
|
return (ret > 0) ? ret : 0;
|
||||||
}
|
}
|
||||||
@ -836,6 +836,9 @@ object_exists(const char *object)
|
|||||||
static int
|
static int
|
||||||
callback(void *args, int argc, char **argv, char **azColName)
|
callback(void *args, int argc, char **argv, char **azColName)
|
||||||
{
|
{
|
||||||
|
(void)args;
|
||||||
|
(void)argc;
|
||||||
|
(void)azColName;
|
||||||
struct Response *passed_args = (struct Response *)args;
|
struct Response *passed_args = (struct Response *)args;
|
||||||
char *id = argv[0], *parent = argv[1], *refID = argv[2], *detailID = argv[3], *class = argv[4], *size = argv[5], *title = argv[6],
|
char *id = argv[0], *parent = argv[1], *refID = argv[2], *detailID = argv[3], *class = argv[4], *size = argv[5], *title = argv[6],
|
||||||
*duration = argv[7], *bitrate = argv[8], *sampleFrequency = argv[9], *artist = argv[10], *album = argv[11],
|
*duration = argv[7], *bitrate = argv[8], *sampleFrequency = argv[9], *artist = argv[10], *album = argv[11],
|
||||||
@ -1295,6 +1298,7 @@ callback(void *args, int argc, char **argv, char **azColName)
|
|||||||
static void
|
static void
|
||||||
BrowseContentDirectory(struct upnphttp * h, const char * action)
|
BrowseContentDirectory(struct upnphttp * h, const char * action)
|
||||||
{
|
{
|
||||||
|
(void)action;
|
||||||
static const char resp0[] =
|
static const char resp0[] =
|
||||||
"<u:BrowseResponse "
|
"<u:BrowseResponse "
|
||||||
"xmlns:u=\"urn:schemas-upnp-org:service:ContentDirectory:1\">"
|
"xmlns:u=\"urn:schemas-upnp-org:service:ContentDirectory:1\">"
|
||||||
@ -1817,6 +1821,7 @@ parse_search_criteria(const char *str, char *sep)
|
|||||||
static void
|
static void
|
||||||
SearchContentDirectory(struct upnphttp * h, const char * action)
|
SearchContentDirectory(struct upnphttp * h, const char * action)
|
||||||
{
|
{
|
||||||
|
(void)action;
|
||||||
static const char resp0[] =
|
static const char resp0[] =
|
||||||
"<u:SearchResponse "
|
"<u:SearchResponse "
|
||||||
"xmlns:u=\"urn:schemas-upnp-org:service:ContentDirectory:1\">"
|
"xmlns:u=\"urn:schemas-upnp-org:service:ContentDirectory:1\">"
|
||||||
@ -2063,6 +2068,7 @@ static void _kodi_decode(char *str)
|
|||||||
case '/':
|
case '/':
|
||||||
if (!str[1])
|
if (!str[1])
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
str++;
|
str++;
|
||||||
break;
|
break;
|
||||||
@ -2082,6 +2088,7 @@ static int duration_sec(const char *str)
|
|||||||
|
|
||||||
static void UpdateObject(struct upnphttp * h, const char * action)
|
static void UpdateObject(struct upnphttp * h, const char * action)
|
||||||
{
|
{
|
||||||
|
(void)action;
|
||||||
static const char resp[] =
|
static const char resp[] =
|
||||||
"<u:UpdateObjectResponse"
|
"<u:UpdateObjectResponse"
|
||||||
" xmlns:u=\"urn:schemas-upnp-org:service:ContentDirectory:1\">"
|
" xmlns:u=\"urn:schemas-upnp-org:service:ContentDirectory:1\">"
|
||||||
@ -2166,6 +2173,7 @@ static void UpdateObject(struct upnphttp * h, const char * action)
|
|||||||
static void
|
static void
|
||||||
SamsungGetFeatureList(struct upnphttp * h, const char * action)
|
SamsungGetFeatureList(struct upnphttp * h, const char * action)
|
||||||
{
|
{
|
||||||
|
(void)action;
|
||||||
static const char resp[] =
|
static const char resp[] =
|
||||||
"<u:X_GetFeatureListResponse xmlns:u=\"urn:schemas-upnp-org:service:ContentDirectory:1\">"
|
"<u:X_GetFeatureListResponse xmlns:u=\"urn:schemas-upnp-org:service:ContentDirectory:1\">"
|
||||||
"<FeatureList>"
|
"<FeatureList>"
|
||||||
@ -2215,6 +2223,7 @@ SamsungGetFeatureList(struct upnphttp * h, const char * action)
|
|||||||
static void
|
static void
|
||||||
SamsungSetBookmark(struct upnphttp * h, const char * action)
|
SamsungSetBookmark(struct upnphttp * h, const char * action)
|
||||||
{
|
{
|
||||||
|
(void)action;
|
||||||
static const char resp[] =
|
static const char resp[] =
|
||||||
"<u:X_SetBookmarkResponse"
|
"<u:X_SetBookmarkResponse"
|
||||||
" xmlns:u=\"urn:schemas-upnp-org:service:ContentDirectory:1\">"
|
" xmlns:u=\"urn:schemas-upnp-org:service:ContentDirectory:1\">"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user