[icecast-dev] bind bug in sock.c & fix

Scott Draves spot at inktomi.com
Tue Aug 21 15:57:44 PDT 2001



in the latest code, sock.c in sock_get_server_socket
line 925 handles the case where the interface to listen on
has been specified numerically:

        if (info.myhostname != NULL && info.myhostname[0]) {
                if (isdigit((int) info.myhostname[0])
                    && isdigit((int) info.
                               myhostname[ice_strlen(info.myhostname) - 1])) {
                        if (inet_aton
                            (info.myhostname,
                             (struct in_addr *) &localaddr) == 0) {
                                write_log(LOG_DEFAULT,
                                          "ERROR: Invalid ip number %s, will die now",
                                          info.myhostname);
                                clean_shutdown(&info);
                        }
                } else {

but the result is never copied into the sockaddr_in structure, as it is in the
gethostbyname case that follows.  the fix is a one-line addition:

        if (info.myhostname != NULL && info.myhostname[0]) {
                if (isdigit((int) info.myhostname[0])
                    && isdigit((int) info.
                               myhostname[ice_strlen(info.myhostname) - 1])) {
                        if (inet_aton
                            (info.myhostname,
                             (struct in_addr *) &localaddr) == 0) {
                                write_log(LOG_DEFAULT,
                                          "ERROR: Invalid ip number %s, will die now",
                                          info.myhostname);
                                clean_shutdown(&info);
                        }
                        sin.sin_addr = localaddr;
                } else {

thanks for the wonderful free software.

-spot

--- >8 ----
List archives:  http://www.xiph.org/archives/
icecast project homepage: http://www.icecast.org/
To unsubscribe from this list, send a message to 'icecast-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Icecast-dev mailing list