OSDN Git Service

getservice: fix handling of long lines
authorNatanael Copa <natanael.copa@gmail.com>
Thu, 14 Oct 2010 06:35:08 +0000 (06:35 +0000)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Thu, 14 Oct 2010 13:00:01 +0000 (15:00 +0200)
commit2631ae8aab71c350273fa2d7a787bfcbff258029
treefdfa842e63a6d36de14edad17f81157d9062b5d7
parent6e74339e7d762857579169068b060a4fd3f345c4
getservice: fix handling of long lines

Don't try to be smart by dynamically realloc buffersize as it doesn't
work. Instead, be simple and allocate a buffer big enough.

This fixes a memory leak when calling getserv{ent,byname,byport}
multiple times.

To save memory we reduce number of max aliases. We seldomly will need
more than 1 anyways. While here, fix segfault that happened if there
were too many aliases.

Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
libc/inet/getservice.c