parse_sun.c error
To whom it may concern,
I have noticed that the following code in parse_sun.c has a duplicate memory allocation.
The error is present in both autofs-4.1.4 and autofs-5.0.1-rc1.
I have also attached a diff file.
4.1.4
parse_sun.c
650 what = alloca(loclen + 1);
651 memcpy(what, loc, loclen);
652 what[loclen] = '\0';
653
654 if (!strcmp(fstype, "autofs") && strchr(loc, ':') == NULL) {
655 char mtype[7];
656 int mtype_len;
657
658 if (loc[0] == '/') {
659 mtype_len = 5;
660 if (loc[1] == '/')
661 strcpy(mtype, "ldap:");
662 else
663 strcpy(mtype, "file:");
664 } else {
665 mtype_len = 3;
666 strcpy(mtype, "yp:");
667 }
668
669 what = alloca(loclen + mtype_len + 1);
670 memcpy(what, mtype, mtype_len);
671 memcpy(what + mtype_len, loc, loclen);
672 what[loclen + mtype_len] = '\0';
673 } else {
674 what = alloca(loclen + 1);
675 memcpy(what, loc, loclen);
676 what[loclen] = '\0';
677 }5.0.1-rc1
647 what = alloca(loclen + 1);
648 memcpy(what, loc, loclen);
649 what[loclen] = '\0';
650 /*
651 if (!strcmp(fstype, "autofs") && strchr(loc, ':') == NULL) {
652 char mtype[7];
653 int mtype_len;
654
655 if (loc[0] == '/') {
656 mtype_len = 5;
657 if (loc[1] == '/')
658 strcpy(mtype, "ldap:");
659 else
660 strcpy(mtype, "file:");
661 } else {
662 mtype_len = 3;
663 strcpy(mtype, "yp:");
664 }
665
666 what = alloca(loclen + mtype_len + 1);
667 memcpy(what, mtype, mtype_len);
668 memcpy(what + mtype_len, loc, loclen);
669 what[loclen + mtype_len] = '\0';
670 } else {
671 */
672 what = alloca(loclen + 1);
673 memcpy(what, loc, loclen);
674 what[loclen] = '\0';
675 /* } */modules/parse_sun.c +0 -4
@@ -647,10 +647,6 @@ mountpoint =alloca (namelen +1 );sprintf (mountpoint,"%.*s" , namelen, name); - what =alloca (loclen +1 ); -memcpy (what, loc, loclen); - what[loclen] ='\0' ; -if (!strcmp (fstype,"autofs" ) &&strchr (loc,':' ) ==NULL ) {char mtype[7 ];int mtype_len;
modules/parse_sun.c +0 -3
@@ -669,9 +669,6 @@what[loclen + mtype_len] = '\0'; } else { */ - what =alloca (loclen +1 ); -memcpy (what, loc, loclen); - what[loclen] ='\0' ;/* } */ debug(ap->logopt,
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs