Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!olivea!tymix!cirrusl!sunstorm!dhesi From: dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) Newsgroups: comp.std.c Subject: strncat is insufficient Message-ID: <2201@cirrusl.UUCP> Date: 12 Aug 90 01:30:06 GMT Sender: news@cirrusl.UUCP Organization: Cirrus Logic Inc. Lines: 17 Having recently written some code that does string manipulation and takes some pains to avoid buffer overflow, I conclude that strncat() is nearly useless. Most of the time I want to avoid string overflow by doing this: append str2 to str1, but cause at most n characters to be in str1. Here is what strncat() does: append str2 to str1, but copy at most n characters. I think the standard C library badly needs another function called, say, strlimcat(), which limits the length of the destination string to some value. -- Rahul Dhesi UUCP: oliveb!cirrusl!dhesi