summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2011-01-12 12:58:44 +0200
committerStefan Kost <ensonic@users.sf.net>2011-01-25 16:17:14 +0200
commit5cc2e6af79e0976b84b50dc8d2d3262d7daaf01c (patch)
tree09df47567e754b5f6dda662654cc6deb394d8e2a
parent7fc30f2d838940afd94c6e690811af41deec6184 (diff)
nettimeprovider: handle invalid network addresses earlier
Handle inet_aton() return code.
-rw-r--r--libs/gst/net/gstnettimeprovider.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libs/gst/net/gstnettimeprovider.c b/libs/gst/net/gstnettimeprovider.c
index 446e61035..a3e80e008 100644
--- a/libs/gst/net/gstnettimeprovider.c
+++ b/libs/gst/net/gstnettimeprovider.c
@@ -373,8 +373,11 @@ gst_net_time_provider_start (GstNetTimeProvider * self)
my_addr.sin_family = AF_INET; /* host byte order */
my_addr.sin_port = htons ((gint16) self->port); /* short, network byte order */
my_addr.sin_addr.s_addr = INADDR_ANY;
- if (self->address)
- inet_aton (self->address, &my_addr.sin_addr);
+ if (self->address) {
+ ret = inet_aton (self->address, &my_addr.sin_addr);
+ if (ret == 0)
+ goto invalid_address_error;
+ }
GST_DEBUG_OBJECT (self, "binding on port %d", self->port);
ret =
@@ -428,6 +431,14 @@ setsockopt_error:
g_strerror (errno), errno);
return FALSE;
}
+invalid_address_error:
+ {
+ close (self->priv->sock.fd);
+ self->priv->sock.fd = -1;
+ GST_ERROR_OBJECT (self, "invalid network address %s: %s (%d)",
+ self->address, g_strerror (errno), errno);
+ return FALSE;
+ }
bind_error:
{
close (self->priv->sock.fd);