Changeset - r21520:22c5c9550ff0
[Not reviewed]
master
0 1 0
rubidium - 10 years ago 2014-06-09 17:43:59
rubidium@openttd.org
(svn r26637) -Fix [FS#6038]: segmentation fault when encountering a .obg/.obs/.obm with empty string/zero length/ MD5 checksums
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/base_media_func.h
Show inline comments
 
@@ -91,25 +91,25 @@ bool BaseSet<T, Tnum_files, Tsearch_in_t
 
		if (filename == NULL) {
 
			file->filename = NULL;
 
			/* If we list no file, that file must be valid */
 
			this->valid_files++;
 
			this->found_files++;
 
			continue;
 
		}
 

	
 
		file->filename = str_fmt("%s%s", path, filename);
 

	
 
		/* Then find the MD5 checksum */
 
		item = md5s->GetItem(filename, false);
 
		if (item == NULL) {
 
		if (item == NULL || item->value == NULL) {
 
			DEBUG(grf, 0, "No MD5 checksum specified for: %s (in %s)", filename, full_filename);
 
			return false;
 
		}
 
		char *c = item->value;
 
		for (uint i = 0; i < sizeof(file->hash) * 2; i++, c++) {
 
			uint j;
 
			if ('0' <= *c && *c <= '9') {
 
				j = *c - '0';
 
			} else if ('a' <= *c && *c <= 'f') {
 
				j = *c - 'a' + 10;
 
			} else if ('A' <= *c && *c <= 'F') {
 
				j = *c - 'A' + 10;
0 comments (0 inline, 0 general)