Fix a typo when the '/' character is tested on the last but one position instead of the last.
There have to be more allocated more memory in the same function.
Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
int len = strlen(input);
/* if input does not end with '/', allocate one more space for it */
- if ((input[len-2]) != '/')
+ if ((input[len-1]) != '/')
len = len+1;
- output = (char *)malloc(sizeof(char)*(len));
+ output = (char *)malloc(sizeof(char)*(len+1));
if (output == NULL)
return NULL;