fix path concatenation

This commit is contained in:
Florian Dold 2019-11-01 17:09:52 +01:00
parent 375a47d502
commit 29fac256fa
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -677,14 +677,12 @@ TALER_buffer_write_path (struct TALER_Buffer *buf, const char *str)
{
size_t len = strlen (str);
if (0 == len)
return;
if ('/' == str[0])
while ( (0 != len) && ('/' == str[0]) )
{
str++;
len--;
}
if ( (0 == buf->position) || ('/' != buf->mem[buf->position]) )
if ( (0 == buf->position) || ('/' != buf->mem[buf->position - 1]) )
{
TALER_buffer_ensure_remaining (buf, 1);
buf->mem[buf->position++] = '/';