|
@@ -632,27 +632,30 @@ static struct xfer_interface_operations slam_xfer_operations = {
|
632
|
632
|
static int slam_parse_multicast_address ( struct slam_request *slam,
|
633
|
633
|
const char *path,
|
634
|
634
|
struct sockaddr_in *address ) {
|
635
|
|
- char path_dup[ strlen ( path ) + 1 ];
|
|
635
|
+ char path_dup[ strlen ( path ) /* no +1 */ ];
|
636
|
636
|
char *sep;
|
|
637
|
+ char *end;
|
637
|
638
|
|
638
|
|
- /* Create temporary copy of path */
|
639
|
|
- memcpy ( path_dup, path, sizeof ( path_dup ) );
|
|
639
|
+ /* Create temporary copy of path, minus the leading '/' */
|
|
640
|
+ assert ( *path == '/' );
|
|
641
|
+ memcpy ( path_dup, ( path + 1 ) , sizeof ( path_dup ) );
|
640
|
642
|
|
641
|
643
|
/* Parse port, if present */
|
642
|
644
|
sep = strchr ( path_dup, ':' );
|
643
|
645
|
if ( sep ) {
|
644
|
646
|
*(sep++) = '\0';
|
645
|
|
- address->sin_port = htons ( strtoul ( sep, &sep, 0 ) );
|
646
|
|
- if ( *sep != '\0' ) {
|
647
|
|
- DBGC ( slam, "SLAM %p invalid multicast port\n",
|
648
|
|
- slam );
|
|
647
|
+ address->sin_port = htons ( strtoul ( sep, &end, 0 ) );
|
|
648
|
+ if ( *end != '\0' ) {
|
|
649
|
+ DBGC ( slam, "SLAM %p invalid multicast port "
|
|
650
|
+ "\"%s\"\n", slam, sep );
|
649
|
651
|
return -EINVAL;
|
650
|
652
|
}
|
651
|
653
|
}
|
652
|
654
|
|
653
|
655
|
/* Parse address */
|
654
|
656
|
if ( inet_aton ( path_dup, &address->sin_addr ) == 0 ) {
|
655
|
|
- DBGC ( slam, "SLAM %p invalid multicast address\n", slam );
|
|
657
|
+ DBGC ( slam, "SLAM %p invalid multicast address \"%s\"\n",
|
|
658
|
+ slam, path_dup );
|
656
|
659
|
return -EINVAL;
|
657
|
660
|
}
|
658
|
661
|
|