Skip to content

nominatim: Correctly read response data from soup3

Will Thompson requested to merge wip/wjt/30-nominatim-soup3 into master

Previously, the soup3 branch would call g_bytes_unref_to_data() on the response data, with a NULL out parameter for the size, and then proceed to use the data pointer as a NULL-terminated string. This is wrong for two reasons:

  • g_bytes_unref_to_data()'s size parameter may not be NULL
  • The response data is not NULL-terminated

Instead, do what the soup2 branch does: use g_strndup() to get a NULL-terminated string.

No automatic test, but the async branch at least can be tested by running the test binary with an argument:

_build/geocode-glib/tests/geocode-glib aoeuaoeuaoeu

Note that you must change the search term each time, since the result is cached.

Fixes: #30 (closed)

Merge request reports