re-correct fallback strlcpy(). do not choke on z == 0.
This commit is contained in:
parent
8cb4bb315b
commit
acc7a22687
|
@ -30,7 +30,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* 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
|
#ifndef pcap_int_h
|
||||||
|
@ -136,7 +136,9 @@ int pcap_read(pcap_t *, int cnt, pcap_handler, u_char *);
|
||||||
|
|
||||||
#ifndef HAVE_STRLCPY
|
#ifndef HAVE_STRLCPY
|
||||||
#define strlcpy(x, y, z) \
|
#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
|
#endif
|
||||||
|
|
||||||
/* XXX */
|
/* XXX */
|
||||||
|
|
Reference in New Issue