OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010, Google Inc. | 2 * Copyright 2010, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 struct fmap_area { | 74 struct fmap_area { |
75 uint32_t offset; /* offset relative to base */ | 75 uint32_t offset; /* offset relative to base */ |
76 uint32_t size; /* size in bytes */ | 76 uint32_t size; /* size in bytes */ |
77 uint8_t name[FMAP_STRLEN]; /* descriptive name */ | 77 uint8_t name[FMAP_STRLEN]; /* descriptive name */ |
78 uint16_t flags; /* flags for this area */ | 78 uint16_t flags; /* flags for this area */ |
79 } __attribute__((packed)) areas[]; | 79 } __attribute__((packed)) areas[]; |
80 } __attribute__((packed)); | 80 } __attribute__((packed)); |
81 | 81 |
82 /* | 82 /* |
83 * fmapNormalizeAreaName - to protect malicious attack, this function | 83 * fmapNormalizeAreaName - to protect malicious attack, this function |
84 * replace all non-digits and non-alphabet chars into underline. | 84 * replace not allowed chars into underline. Only following are allowed: |
| 85 * |
| 86 * numbers |
| 87 * digits |
| 88 * space |
| 89 * |
| 90 * The allowing list should increase if fmap area name allows more chars. |
85 * | 91 * |
86 * @name: point to the name. | 92 * @name: point to the name. |
87 */ | 93 */ |
88 void fmapNormalizeAreaName(uint8_t *name); | 94 void fmapNormalizeAreaName(uint8_t *name); |
89 | 95 |
90 | 96 |
91 /* | 97 /* |
92 * fmapFind - finds FMAP signature in a binary image | 98 * fmapFind - finds FMAP signature in a binary image |
93 * | 99 * |
94 * @image: binary image | 100 * @image: binary image |
(...skipping 18 matching lines...) Expand all Loading... |
113 * @size: pointer to store the size of the found area. | 119 * @size: pointer to store the size of the found area. |
114 * | 120 * |
115 * This function returns FMAP_OK if found. Returns FMAP_FAIL if not found. | 121 * This function returns FMAP_OK if found. Returns FMAP_FAIL if not found. |
116 * | 122 * |
117 */ | 123 */ |
118 int fmapGetArea(const char *name, const struct fmap *fmap, | 124 int fmapGetArea(const char *name, const struct fmap *fmap, |
119 off_t *offset, off_t *size); | 125 off_t *offset, off_t *size); |
120 | 126 |
121 | 127 |
122 #endif /* __LIB_FMAP_H__*/ | 128 #endif /* __LIB_FMAP_H__*/ |
OLD | NEW |