Fix a illegal memory access in link_pathname API - Issue#104

The link_pathname() API assembles a list of substrings such as
root, parent, filename and suffix into one. It will insert or
remove extra slashes between root and parent, or between parent
and filename if needed to ensure there is one and only one slash
as delimiter among them.

The root parameter is allowed to be a single slash, however, if
the parent argument equals to "/", it is skipped over but the
slash_followed() will return zero for the empty string and
consequently, an extra "/" is appended. However, this unnecessary
slash has not be taken into account when calculating the length
of the result string, resulting in illegal write attempt when
appending the rest of components.