dect
/
libpcap
Archived
13
0
Fork 0

re-correct fallback strlcpy(). do not choke on z == 0.

This commit is contained in:
itojun 2000-07-04 00:22:03 +00:00
parent 8cb4bb315b
commit acc7a22687
1 changed files with 4 additions and 2 deletions

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.23 2000-07-04 00:10:47 itojun Exp $ (LBL)
* @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.24 2000-07-04 00:22:03 itojun Exp $ (LBL)
*/
#ifndef pcap_int_h
@ -136,7 +136,9 @@ int pcap_read(pcap_t *, int cnt, pcap_handler, u_char *);
#ifndef HAVE_STRLCPY
#define strlcpy(x, y, z) \
(strncpy((x), (y), (z)), (x)[(z) - 1] = '\0', strlen((x)))
(strncpy((x), (y), (z)), \
((z) <= 0 ? 0 : ((x)[(z) - 1] = '\0')), \
strlen((y)))
#endif
/* XXX */