ObjFW  Check-in [b20446bb3a]

Overview
Comment:utils/ofatalkcfg: Ensure ifr_name 0 termination
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b20446bb3a8a20e657bad1f46375d051212ebc8399966688e346a36f12c34bbf
User & Date: js on 2023-04-13 18:42:53
Other Links: manifest | tags
Context
2023-04-15
17:30
OFDDPSocket: Add support for configuring AppleTalk check-in: ccb53db0d8 user: js tags: trunk
2023-04-13
18:42
utils/ofatalkcfg: Ensure ifr_name 0 termination check-in: b20446bb3a user: js tags: trunk
2023-04-12
21:18
utils/ofatalkcfg: Make GCC happy check-in: e63e352467 user: js tags: trunk
Changes

Modified utils/ofatalkcfg/OFATalkCfg.m from [22aa3a0709] to [8054bd9b01].

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
configureInterface(OFString *interface, uint16_t network, uint8_t node,
    uint8_t phase, uint16_t rangeStart, uint16_t rangeEnd)
{
	int sock;
	struct ifreq request;
	struct sockaddr_at *sat;

	if (interface.UTF8StringLength > IFNAMSIZ) {
		[OFStdErr writeFormat: @"%@: Interface name too long!\n",
				       [OFApplication programName]];
		[OFApplication terminateWithStatus: 1];
	}

#ifdef OF_MACOS
	if ((sock = socket(AF_APPLETALK, SOCK_RAW, 0)) < 0) {







|







42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
configureInterface(OFString *interface, uint16_t network, uint8_t node,
    uint8_t phase, uint16_t rangeStart, uint16_t rangeEnd)
{
	int sock;
	struct ifreq request;
	struct sockaddr_at *sat;

	if (interface.UTF8StringLength > IFNAMSIZ - 1) {
		[OFStdErr writeFormat: @"%@: Interface name too long!\n",
				       [OFApplication programName]];
		[OFApplication terminateWithStatus: 1];
	}

#ifdef OF_MACOS
	if ((sock = socket(AF_APPLETALK, SOCK_RAW, 0)) < 0) {
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
					     @"\"modprobe appletalk\"?"];
#endif

		[OFApplication terminateWithStatus: 1];
	}

	memset(&request, 0, sizeof(request));
	strncpy(request.ifr_name, interface.UTF8String, IFNAMSIZ);
	sat = (struct sockaddr_at *)&request.ifr_addr;
	sat->sat_family = AF_APPLETALK;
	sat->sat_net = OFToBigEndian16(network);
	sat->sat_node = node;
	/*
	 * The netrange is hidden in sat_zero and different OSes use different
	 * struct names for it, so the portable way is setting sat_zero







|







69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
					     @"\"modprobe appletalk\"?"];
#endif

		[OFApplication terminateWithStatus: 1];
	}

	memset(&request, 0, sizeof(request));
	strncpy(request.ifr_name, interface.UTF8String, IFNAMSIZ - 1);
	sat = (struct sockaddr_at *)&request.ifr_addr;
	sat->sat_family = AF_APPLETALK;
	sat->sat_net = OFToBigEndian16(network);
	sat->sat_node = node;
	/*
	 * The netrange is hidden in sat_zero and different OSes use different
	 * struct names for it, so the portable way is setting sat_zero