mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-18 15:30:21 +00:00
Fix buffer overflow and possible ISO image corruption in wrong
handling of "." character case in makefs ISO level 1 and 2 filename conversion. Filed as NetBSD PR #45285 http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=45285 Reviewed by: Christos Zoulas <christos@netbsd.org> Approved by: re (kib) MFC after: 3 days
This commit is contained in:
parent
aefb9fe04f
commit
b958f4853c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=225121
@ -1627,7 +1627,7 @@ cd9660_level1_convert_filename(const char *oldname, char *newname, int is_file)
|
||||
int extlen = 0;
|
||||
int found_ext = 0;
|
||||
|
||||
while (*oldname != '\0') {
|
||||
while (*oldname != '\0' && extlen < 3) {
|
||||
/* Handle period first, as it is special */
|
||||
if (*oldname == '.') {
|
||||
if (found_ext) {
|
||||
@ -1644,10 +1644,8 @@ cd9660_level1_convert_filename(const char *oldname, char *newname, int is_file)
|
||||
*oldname == ',' && strlen(oldname) == 4)
|
||||
break;
|
||||
/* Enforce 12.3 / 8 */
|
||||
if (((namelen == 8) && !found_ext) ||
|
||||
(found_ext && extlen == 3)) {
|
||||
if (namelen == 8 && !found_ext)
|
||||
break;
|
||||
}
|
||||
|
||||
if (islower((unsigned char)*oldname))
|
||||
*newname++ = toupper((unsigned char)*oldname);
|
||||
@ -1690,7 +1688,7 @@ cd9660_level2_convert_filename(const char *oldname, char *newname, int is_file)
|
||||
int extlen = 0;
|
||||
int found_ext = 0;
|
||||
|
||||
while (*oldname != '\0') {
|
||||
while (*oldname != '\0' && namelen + extlen < 30) {
|
||||
/* Handle period first, as it is special */
|
||||
if (*oldname == '.') {
|
||||
if (found_ext) {
|
||||
@ -1710,8 +1708,6 @@ cd9660_level2_convert_filename(const char *oldname, char *newname, int is_file)
|
||||
if (diskStructure.archimedes_enabled &&
|
||||
*oldname == ',' && strlen(oldname) == 4)
|
||||
break;
|
||||
if ((namelen + extlen) == 30)
|
||||
break;
|
||||
|
||||
if (islower((unsigned char)*oldname))
|
||||
*newname++ = toupper((unsigned char)*oldname);
|
||||
|
Loading…
Reference in New Issue
Block a user