You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
udp: Fix crashes after adding AVOptions
Add a missing AVClass member, check whether localaddr is null.
(Previously, localaddr was always a local stack buffer, while it
now also can be an avoption string which can be null.)
This fixes crashes when not passing any localaddr parameter, since
66028b7ba
.
Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
@@ -42,6 +42,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct UDPContext {
|
typedef struct UDPContext {
|
||||||
|
const AVClass *class;
|
||||||
int udp_fd;
|
int udp_fd;
|
||||||
int ttl;
|
int ttl;
|
||||||
int buffer_size;
|
int buffer_size;
|
||||||
@@ -293,7 +294,7 @@ static int udp_socket_create(UDPContext *s, struct sockaddr_storage *addr,
|
|||||||
|
|
||||||
if (((struct sockaddr *) &s->dest_addr)->sa_family)
|
if (((struct sockaddr *) &s->dest_addr)->sa_family)
|
||||||
family = ((struct sockaddr *) &s->dest_addr)->sa_family;
|
family = ((struct sockaddr *) &s->dest_addr)->sa_family;
|
||||||
res0 = udp_resolve_host(localaddr[0] ? localaddr : NULL, s->local_port,
|
res0 = udp_resolve_host((localaddr && localaddr[0]) ? localaddr : NULL, s->local_port,
|
||||||
SOCK_DGRAM, family, AI_PASSIVE);
|
SOCK_DGRAM, family, AI_PASSIVE);
|
||||||
if (res0 == 0)
|
if (res0 == 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
Reference in New Issue
Block a user