Changeset 28ecadb in mainline for boot/genarch/ofw_tree.c
- Timestamp:
- 2006-09-22T21:44:54Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5d684e4
- Parents:
- 16529d5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/genarch/ofw_tree.c
r16529d5 r28ecadb 48 48 static void * ofw_tree_space_alloc(size_t size) 49 49 { 50 return balloc(size, size); 50 char *addr; 51 52 /* 53 * What we do here is a nasty hack :-) 54 * Problem: string property values that are allocated via this 55 * function typically do not contain the trailing '\0'. This 56 * is very uncomfortable for kernel, which is supposed to deal 57 * with the properties. 58 * Solution: when allocating space via this function, we always 59 * allocate space for the extra '\0' character that we store 60 * behind the requested memory. 61 */ 62 addr = balloc(size + 1, size); 63 if (addr) 64 addr[size] = '\0'; 65 return addr; 51 66 } 52 67 … … 154 169 break; 155 170 156 strncpy(current_node->property[i].name, name, sizeof(name)); 171 memcpy(current_node->property[i].name, name, OFW_TREE_PROPERTY_MAX_NAMELEN); 172 current_node->property[i].name[OFW_TREE_PROPERTY_MAX_NAMELEN] = '\0'; 157 173 158 174 size = ofw_get_proplen(current, name);
Note:
See TracChangeset
for help on using the changeset viewer.