Browse Source

Fix potential memory error when serialising URIs

zrythm_meson
David Robillard 2 years ago
parent
commit
48635c1e2c
  1. 3
      NEWS
  2. 3
      src/uri.c

3
NEWS

@ -1,9 +1,10 @@ @@ -1,9 +1,10 @@
serd (0.30.7) unstable;
* Fix potential memory error when serialising URIs
* Move headers to an include directory
* Split up and reorganize unit tests
-- David Robillard <d@drobilla.net> Mon, 09 Nov 2020 19:02:52 +0000
-- David Robillard <d@drobilla.net> Tue, 10 Nov 2020 21:04:06 +0000
serd (0.30.6) stable;

3
src/uri.c

@ -448,7 +448,8 @@ serd_uri_serialise_relative(const SerdURI* uri, @@ -448,7 +448,8 @@ serd_uri_serialise_relative(const SerdURI* uri,
if (uri->authority.buf) {
len += sink("//", 2, stream);
len += sink(uri->authority.buf, uri->authority.len, stream);
if (uri->authority.buf[uri->authority.len - 1] != '/' &&
if (uri->authority.len > 0 &&
uri->authority.buf[uri->authority.len - 1] != '/' &&
serd_uri_path_starts_without_slash(uri)) {
// Special case: ensure path begins with a slash
// https://tools.ietf.org/html/rfc3986#section-3.2

Loading…
Cancel
Save