cbfstool: allow printable characters in image name

Currently cbfstool would reject non-alpanumeric characters in
image names. Underscore is not alphanumeric and is used in some
default fmaps. This change allows image names to contain all
"printable" characters except spaces.

Change-Id: I6ba2b581d5623f5b028149ece0169892ea63fd04
Signed-off-by: Andrey Petrov <andrey.petrov@intel.com>
Reviewed-on: http://review.coreboot.org/11807
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Andrey Petrov 2015-10-07 13:37:49 -07:00 committed by Alexandru Gagniuc
parent ee2740b7f6
commit a2bed346a1
1 changed files with 4 additions and 4 deletions

View File

@ -89,12 +89,12 @@ static int is_valid_fmap(const struct fmap *fmap)
while (i < FMAP_STRLEN) { while (i < FMAP_STRLEN) {
if (fmap->name[i] == 0) if (fmap->name[i] == 0)
break; break;
if (!isalnum(fmap->name[i])) if (!isgraph(fmap->name[i]))
return 0; return 0;
if (i == FMAP_STRLEN - 1) { if (i == FMAP_STRLEN - 1) {
/* name is specified to be null terminated. We didn't /* name is specified to be null terminated single-word string
* break in the 0 test, we didn't fail on the alnum * without spaces. We did not break in the 0 test, we know it
* test, so we're seeing FMAP_STRLEN alphanumerical * is a printable spaceless string but we're seeing FMAP_STRLEN
* symbols, which is one too many. * symbols, which is one too many.
*/ */
return 0; return 0;