aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2002-10-05 20:55:54 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2002-10-05 20:55:54 +0200
commitc49d2df6cc3675364f51c5b4b9e35840edfb312e (patch)
tree3f08c124b012b43d45c6dc5317707ba5f8e5e905 /gcc/gcc.c
parentd758c1db6bad001b7ff82cf36d075de21fa75e05 (diff)
downloadgcc-c49d2df6cc3675364f51c5b4b9e35840edfb312e.zip
gcc-c49d2df6cc3675364f51c5b4b9e35840edfb312e.tar.gz
gcc-c49d2df6cc3675364f51c5b4b9e35840edfb312e.tar.bz2
gcc.c (set_multilib_dir): Don't access *end.
* gcc.c (set_multilib_dir): Don't access *end. Use memcpy instead of strncpy. Don't write beyond malloced buffer. (print_multilib_info): Don't show paths starting with ".:". * genmultilib: Add new option, "yes" if multilibs are enabled. Update comments. If multilibs not enabled, print .:${osdirout} for each directory. If multilibs are enabled, always print ${dirout}:${osdirout}, even if the two are the same. * Makefile.in (s-mlib): Pass @enable_multilib@ to genmultilib. Pass all MULTILIB_* variables to genmultilib even if --disable-multilib but MULTILIB_OSDIRNAMES is not empty. From-SVN: r57846
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index b9794fe..167dde7 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -6926,11 +6926,11 @@ set_multilib_dir ()
while (q < end && *q != ':')
q++;
- if (*q == ':')
+ if (q < end)
{
char *new_multilib_os_dir = xmalloc (end - q);
- strncpy (new_multilib_os_dir, q + 1, end - q - 1);
- new_multilib_os_dir[end - q] = '\0';
+ memcpy (new_multilib_os_dir, q + 1, end - q - 1);
+ new_multilib_os_dir[end - q - 1] = '\0';
multilib_os_dir = new_multilib_os_dir;
break;
}
@@ -6986,6 +6986,12 @@ print_multilib_info ()
++p;
}
+ /* When --disable-multilib was used but target defines
+ MULTILIB_OSDIRNAMES, entries starting with .: are there just
+ to find multilib_os_dir, so skip them from output. */
+ if (this_path[0] == '.' && this_path[1] == ':')
+ skip = 1;
+
/* Check for matches with the multilib_exclusions. We don't bother
with the '!' in either list. If any of the exclusion rules match
all of its options with the select rule, we skip it. */