ObjFW  Check-in [05207af0f6]

Overview
Comment:Don't use strlen in -[appendCString:withLength:].
This might cause trouble if the string is not terminated.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 05207af0f61661e94923ff26bf48b6a5096a00d9b6269cac850139e3f376fba1
User & Date: js on 2010-12-26 00:01:45
Other Links: manifest | tags
Context
2010-12-26
02:47
Nicer overflow check in -[decimalValue]. check-in: d2567246f9 user: js tags: trunk
00:01
Don't use strlen in -[appendCString:withLength:].
This might cause trouble if the string is not terminated.
check-in: 05207af0f6 user: js tags: trunk
2010-12-25
23:29
Add +[OFFile modificationDateOfFile:] and change -[OFDate description]. check-in: 2d8533a428 user: js tags: trunk
Changes

Modified src/OFMutableString.m from [bb152a87a3] to [617a9d8416].

168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
	memcpy(string + length, str, strlength + 1);
	length += strlength;
}

- (void)appendCString: (const char*)str
	   withLength: (size_t)len
{
	if (len > strlen(str))
		@throw [OFOutOfRangeException newWithClass: isa];

	switch (of_string_check_utf8(str, len)) {
	case 1:
		isUTF8 = YES;
		break;
	case -1:
		@throw [OFInvalidEncodingException newWithClass: isa];
	}







<
<
<







168
169
170
171
172
173
174



175
176
177
178
179
180
181
	memcpy(string + length, str, strlength + 1);
	length += strlength;
}

- (void)appendCString: (const char*)str
	   withLength: (size_t)len
{



	switch (of_string_check_utf8(str, len)) {
	case 1:
		isUTF8 = YES;
		break;
	case -1:
		@throw [OFInvalidEncodingException newWithClass: isa];
	}