@@ -935,18 +935,24 @@ int PS4_SYSV_ABI sceHttpUriParse(OrbisHttpUriElement* out, const char* srcUri, v
935935 pathLength++;
936936 }
937937
938- // Ensure the path starts with '/'
939- if (pathLength > 0 && pathStart[0 ] != ' /' ) {
938+ if (pathLength > 0 ) {
940939 // Prepend '/' to the path
941940 requiredSize += pathLength + 2 ; // Include '/' and null terminator
942941
943942 if (pool && prepare < requiredSize) {
944- LOG_ERROR (Lib_Http, " out of memory" );
943+ LOG_ERROR (Lib_Http, " out of memory, provided size: {}, required size: {}" ,
944+ prepare, requiredSize);
945945 return ORBIS_HTTP_ERROR_OUT_OF_MEMORY;
946946 }
947947
948948 if (out && pool) {
949949 out->path = (char *)pool + (requiredSize - pathLength - 2 );
950+ out->username = (char *)pool + (requiredSize - pathLength - 3 );
951+ out->password = (char *)pool + (requiredSize - pathLength - 3 );
952+ out->hostname = (char *)pool + (requiredSize - pathLength - 3 );
953+ out->query = (char *)pool + (requiredSize - pathLength - 3 );
954+ out->fragment = (char *)pool + (requiredSize - pathLength - 3 );
955+ out->username [0 ] = ' \0 ' ;
950956 out->path [0 ] = ' /' ; // Add leading '/'
951957 memcpy (out->path + 1 , pathStart, pathLength);
952958 out->path [pathLength + 1 ] = ' \0 ' ;
@@ -969,6 +975,19 @@ int PS4_SYSV_ABI sceHttpUriParse(OrbisHttpUriElement* out, const char* srcUri, v
969975
970976 // Move past the path
971977 offset += pathLength;
978+ } else {
979+ // Parse the path (everything after the slashes)
980+ char * pathStart = (char *)srcUri + offset;
981+ u64 pathLength = 0 ;
982+ while (pathStart[pathLength] && pathStart[pathLength] != ' ?' &&
983+ pathStart[pathLength] != ' #' ) {
984+ pathLength++;
985+ }
986+
987+ if (pathLength > 0 ) {
988+ requiredSize += pathLength + 3 ; // Add '/' and null terminator, and the dummy
989+ // null character for the other fields
990+ }
972991 }
973992 }
974993
0 commit comments