Mercurial > mplayer.hg
comparison stream/tcp.c @ 29351:d58878f243ea
Replace incorrect use of strncpy by av_strlcpy.
Only a real issue if inet_ntoa can actually return a string of more than 255 bytes.
author | reimar |
---|---|
date | Fri, 26 Jun 2009 13:54:22 +0000 |
parents | 0f1b5b68af32 |
children | ce0122361a39 |
comparison
equal
deleted
inserted
replaced
29350:a5c49ea5059a | 29351:d58878f243ea |
---|---|
31 #endif | 31 #endif |
32 | 32 |
33 #include "network.h" | 33 #include "network.h" |
34 #include "stream.h" | 34 #include "stream.h" |
35 #include "tcp.h" | 35 #include "tcp.h" |
36 #include "libavutil/avstring.h" | |
36 | 37 |
37 /* IPv6 options */ | 38 /* IPv6 options */ |
38 int network_prefer_ipv4 = 0; | 39 int network_prefer_ipv4 = 0; |
39 | 40 |
40 // Converts an address family constant to a string | 41 // Converts an address family constant to a string |
161 mp_msg(MSGT_NETWORK,MSGL_ERR, MSGTR_MPDEMUX_NW_UnknownAF, af); | 162 mp_msg(MSGT_NETWORK,MSGL_ERR, MSGTR_MPDEMUX_NW_UnknownAF, af); |
162 return TCP_ERROR_FATAL; | 163 return TCP_ERROR_FATAL; |
163 } | 164 } |
164 | 165 |
165 #if HAVE_INET_ATON || defined(HAVE_WINSOCK2_H) | 166 #if HAVE_INET_ATON || defined(HAVE_WINSOCK2_H) |
166 strncpy( buf, inet_ntoa( *((struct in_addr*)our_s_addr) ), 255); | 167 av_strlcpy( buf, inet_ntoa( *((struct in_addr*)our_s_addr) ), 255); |
167 #else | 168 #else |
168 inet_ntop(af, our_s_addr, buf, 255); | 169 inet_ntop(af, our_s_addr, buf, 255); |
169 #endif | 170 #endif |
170 if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,MSGTR_MPDEMUX_NW_ConnectingToServer, host, buf , port ); | 171 if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,MSGTR_MPDEMUX_NW_ConnectingToServer, host, buf , port ); |
171 | 172 |