loader/svg: Return actual decoded size

Returns the actual length of the decoded array.

related issue: https://github.com/thorvg/thorvg/issues/2156
This commit is contained in:
JunsuChoi 2024-04-16 10:48:04 +09:00 committed by Mira Grudzinska
parent da45fa6608
commit 1bbf9bbb7d

View file

@ -47,7 +47,6 @@ size_t svgUtilURLDecode(const char *src, char** dst)
if (length == 0) return 0;
char* decoded = (char*)malloc(sizeof(char) * length + 1);
decoded[length] = '\0';
char a, b;
int idx =0;
@ -64,7 +63,9 @@ size_t svgUtilURLDecode(const char *src, char** dst)
decoded[idx++] = *src++;
}
}
decoded[idx] = '\0';
*dst = decoded;
return length + 1;
}
return idx + 1;
}