Bug in yuarel_parse_query() function
Hello, I found an error when 1 struct yuarel_param is passed to the yuarel_parse_query() function. They are not working properly.
char* query = "a=b&c=d";
yuarel_param params;
yuarel_parse_query(query, '&', ¶ms, 1);
// HERE
// params.key == "a"
// params.val == "b&c=d"
try this:
char query[] = "a=b&c=d";
struct yuarel_param params[1];
ret=yuarel_parse_query(query, '&', params, 1);
This is actually because in https://github.com/jacketizer/libyuarel/blob/master/yuarel.c#L274 it only splits the & delimiter up to max_param times. To fix this issue we would need to do a clean up step where we run this one more time to check if there is additional & to at least null terminate.
That being said, the workaround is simply add at least +1 more to your max_param than your max expected param to overcome this issue.
Okay made the fix in my fork under https://github.com/mofosyne/libyuarel/commit/75eb675f513c4f09bd0da6d6a96a01d7dd90208f