mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-02-16 10:30:47 +00:00
Safely handle missing fields in the serverinfo response. This fixes GFE 2.5.4.54, albeit in a non-ideal manner. A proper fix would be to parse the error out of the response and reissue the query over HTTP if it fails with error code 401.
This commit is contained in:
@@ -124,7 +124,10 @@ static void client_load_server_status(const char *address) {
|
||||
|
||||
paired = pairedText != NULL && strcmp(pairedText, "1") == 0;
|
||||
currentGame = currentGameText == NULL ? 0 : atoi(currentGameText);
|
||||
strstr(versionText, ".")[0] = 0;
|
||||
char *versionSep = strstr(versionText, ".");
|
||||
if (versionSep != NULL) {
|
||||
*versionSep = 0;
|
||||
}
|
||||
serverMajorVersion = atoi(versionText);
|
||||
|
||||
free(pairedText);
|
||||
@@ -306,7 +309,7 @@ void client_pair(const char *address) {
|
||||
sprintf(url, "https://%s:47984/pair?uniqueid=%s&devicename=roth&updateState=1&clientpairingsecret=%s", address, unique_id, client_pairing_secret_hex);
|
||||
http_request(url, data);
|
||||
|
||||
sprintf(url, "https://%s:47984/pair?uniqueid=%s&devicename=roth&updateState=1&phrase=pairchallenge", address, unique_id, challenge_response_hex);
|
||||
sprintf(url, "https://%s:47984/pair?uniqueid=%s&devicename=roth&updateState=1&phrase=pairchallenge", address, unique_id);
|
||||
http_request(url, data);
|
||||
http_free_data(data);
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ int xml_search(char* data, size_t len, char* node, char** result) {
|
||||
struct xml_query search;
|
||||
search.data = node;
|
||||
search.start = 0;
|
||||
search.memory = malloc(1);
|
||||
search.memory = calloc(1, 1);
|
||||
search.size = 0;
|
||||
XML_Parser parser = XML_ParserCreate("UTF-8");
|
||||
XML_SetUserData(parser, &search);
|
||||
@@ -110,7 +110,7 @@ int xml_search(char* data, size_t len, char* node, char** result) {
|
||||
|
||||
struct app_list* xml_applist(char* data, size_t len) {
|
||||
struct xml_query query;
|
||||
query.memory = malloc(1);
|
||||
query.memory = calloc(1, 1);
|
||||
query.size = 0;
|
||||
query.start = 0;
|
||||
query.data = NULL;
|
||||
|
||||
Reference in New Issue
Block a user