ObjFW  Diff

Differences From Artifact [b89d5a3a8f]:

To Artifact [294ed882f2]:


375
376
377
378
379
380
381



























382
383
384
385
386
387
388
#endif
		memcpy(address.sockaddr.in6.sin6_addr.s6_addr, buffer + i, 16);

		return [[[OFAAAADNSResourceRecord alloc]
		    initWithName: name
			 address: &address
			     TTL: TTL] autorelease];



























	} else if (recordType == OFDNSRecordTypeSRV &&
	    DNSClass == OFDNSClassIN) {
		uint16_t priority, weight, port;
		size_t j;
		OFString *target;

		if (dataLength < 6)







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
#endif
		memcpy(address.sockaddr.in6.sin6_addr.s6_addr, buffer + i, 16);

		return [[[OFAAAADNSResourceRecord alloc]
		    initWithName: name
			 address: &address
			     TTL: TTL] autorelease];
	} else if (recordType == OFDNSRecordTypeLOC) {
		uint8_t size, horizontalPrecision, verticalPrecision;
		uint32_t latitude, longitude, altitude;

		if (dataLength < 16 || buffer[i] != 0)
			@throw [OFInvalidServerResponseException exception];

		size = buffer[i + 1];
		horizontalPrecision = buffer[i + 2];
		verticalPrecision = buffer[i + 3];
		latitude = (buffer[i + 4] << 24) | (buffer[i + 5] << 16) |
		    (buffer[i + 6] << 8) | buffer[i + 7];
		longitude = (buffer[i + 8] << 24) | (buffer[i + 9] << 16) |
		    (buffer[i + 10] << 8) | buffer[i + 11];
		altitude = (buffer[i + 12] << 24) | (buffer[i + 13] << 16) |
		    (buffer[i + 14] << 8) | buffer[i + 15];

		return [[[OFLOCDNSResourceRecord alloc]
			   initWithName: name
			       DNSClass: DNSClass
				   size: size
		    horizontalPrecision: horizontalPrecision
		      verticalPrecision: verticalPrecision
			       latitude: latitude
			      longitude: longitude
			       altitude: altitude
				    TTL: TTL] autorelease];
	} else if (recordType == OFDNSRecordTypeSRV &&
	    DNSClass == OFDNSClassIN) {
		uint16_t priority, weight, port;
		size_t j;
		OFString *target;

		if (dataLength < 6)
400
401
402
403
404
405
406




















407
408
409
410
411
412
413

		return [[[OFSRVDNSResourceRecord alloc]
		    initWithName: name
			priority: priority
			  weight: weight
			  target: target
			    port: port




















			     TTL: TTL] autorelease];
	} else
		return [[[OFDNSResourceRecord alloc]
		    initWithName: name
			DNSClass: DNSClass
		      recordType: recordType
			     TTL: TTL] autorelease];







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460

		return [[[OFSRVDNSResourceRecord alloc]
		    initWithName: name
			priority: priority
			  weight: weight
			  target: target
			    port: port
			     TTL: TTL] autorelease];
	} else if (recordType == OFDNSRecordTypeURI) {
		uint16_t priority, weight;
		OFString *target;

		if (dataLength < 4)
			@throw [OFInvalidServerResponseException exception];

		priority = (buffer[i] << 8) | buffer[i + 1];
		weight = (buffer[i + 2] << 8) | buffer[i + 3];

		target = [OFString stringWithUTF8String: (char *)buffer + i + 4
						 length: dataLength - 4];

		return [[[OFURIDNSResourceRecord alloc]
		    initWithName: name
			DNSClass: DNSClass
			priority: priority
			  weight: weight
			  target: target
			     TTL: TTL] autorelease];
	} else
		return [[[OFDNSResourceRecord alloc]
		    initWithName: name
			DNSClass: DNSClass
		      recordType: recordType
			     TTL: TTL] autorelease];
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
		uint32_t TTL;
		uint16_t dataLength;
		OFDNSResourceRecord *record;

		if (*i + 10 > length)
			@throw [OFTruncatedDataException exception];

		recordType = (buffer[*i] << 16) | buffer[*i + 1];
		DNSClass = (buffer[*i + 2] << 16) | buffer[*i + 3];
		TTL = (buffer[*i + 4] << 24) | (buffer[*i + 5] << 16) |
		    (buffer[*i + 6] << 8) | buffer[*i + 7];
		dataLength = (buffer[*i + 8] << 16) | buffer[*i + 9];

		*i += 10;

		if (*i + dataLength > length)
			@throw [OFTruncatedDataException exception];

		record = parseResourceRecord(name, DNSClass, recordType, TTL,







|
|


|







476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
		uint32_t TTL;
		uint16_t dataLength;
		OFDNSResourceRecord *record;

		if (*i + 10 > length)
			@throw [OFTruncatedDataException exception];

		recordType = (buffer[*i] << 8) | buffer[*i + 1];
		DNSClass = (buffer[*i + 2] << 8) | buffer[*i + 3];
		TTL = (buffer[*i + 4] << 24) | (buffer[*i + 5] << 16) |
		    (buffer[*i + 6] << 8) | buffer[*i + 7];
		dataLength = (buffer[*i + 8] << 8) | buffer[*i + 9];

		*i += 10;

		if (*i + dataLength > length)
			@throw [OFTruncatedDataException exception];

		record = parseResourceRecord(name, DNSClass, recordType, TTL,