[vlc-commits] [Git][videolan/vlc][master] 2 commits: sout: udp: fix port parsing

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Feb 11 11:59:06 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
09fbbda5 by Alaric Senat at 2023-02-11T11:46:17+00:00
sout: udp: fix port parsing

Considering an IP address such as `127.0.0.1:1234`.
`end` represent the `:` character matched in an IP address. Given that
the character cursor is already incremented after replacing `:` by `\0`,
we shouldn't skip the first port character.

- - - - -
800b477c by Alaric Senat at 2023-02-11T11:46:17+00:00
sout: udp: fix bracketed IP parsing

Setting the end bracket to string terminator here is injustified. It
will also confuse the subsequent datagram connection.

`vlc --sout="#udp{dst=[::1]:2000}"` failed with:
```
main stream out debug: net: connecting to [[::1]:2000
                                                ^~ Closing bracket
                                                missing here because of
                                                the forced `\0`...
```

Instead, let's just skip the closing brackets.

- - - - -


1 changed file:

- modules/stream_out/udp.c


Changes:

=====================================
modules/stream_out/udp.c
=====================================
@@ -257,7 +257,7 @@ static int Open(vlc_object_t *obj)
         end = strchr(dst, ']');
 
         if (end != NULL)
-            *(end++) = '\0';
+            ++end;
     } else {
         dhost = dst;
         end = strchr(dst, ':');
@@ -265,7 +265,7 @@ static int Open(vlc_object_t *obj)
 
     if (end != NULL && *end == ':') {
         *(end++) = '\0';
-        dport = atoi(&end[1]);
+        dport = atoi(end);
     }
 
     int fd = net_ConnectDgram(stream, dhost, dport, -1, IPPROTO_UDP);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5ebf9e280118b90ad41698c208f60c58b2b3e8ca...800b477ca8cee6ccc6a6b2d9b484a748f153d8cd

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5ebf9e280118b90ad41698c208f60c58b2b3e8ca...800b477ca8cee6ccc6a6b2d9b484a748f153d8cd
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list