View | Details | Raw Unified | Return to bug 10253
Collapse All | Expand All

(-)a/elf/dl-load.c (-4 / +23 lines)
Lines 378-386 static struct r_search_path_struct rtld_search_dirs attribute_relro; Link Here
378
378
379
static size_t max_dirnamelen;
379
static size_t max_dirnamelen;
380
380
381
// ADDED BY THEY4KMAN (1/24/2010): added link_map variable to use for the new
382
//   expand_dynamic_string_token call below.
381
static struct r_search_path_elem **
383
static struct r_search_path_elem **
382
fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
384
fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
383
	      int check_trusted, const char *what, const char *where)
385
	      int check_trusted, const char *what, const char *where,
386
              struct link_map *l)
384
{
387
{
385
  char *cp;
388
  char *cp;
386
  size_t nelems = 0;
389
  size_t nelems = 0;
Lines 388-393 fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep, Link Here
388
  while ((cp = __strsep (&rpath, sep)) != NULL)
391
  while ((cp = __strsep (&rpath, sep)) != NULL)
389
    {
392
    {
390
      struct r_search_path_elem *dirp;
393
      struct r_search_path_elem *dirp;
394
      
395
      // ADDED BY THEY4KMAN (1/24/2010): replacing variables after splitting
396
      //   paths.
397
      cp = expand_dynamic_string_token(l, cp);
398
      
391
      size_t len = strlen (cp);
399
      size_t len = strlen (cp);
392
400
393
      /* `strsep' can pass an empty string.  This has to be
401
      /* `strsep' can pass an empty string.  This has to be
Lines 468-473 fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep, Link Here
468
	  dirp->dirname = ((char *) dirp + sizeof (*dirp)
476
	  dirp->dirname = ((char *) dirp + sizeof (*dirp)
469
			   + ncapstr * sizeof (enum r_dir_status));
477
			   + ncapstr * sizeof (enum r_dir_status));
470
	  *((char *) __mempcpy ((char *) dirp->dirname, cp, len)) = '\0';
478
	  *((char *) __mempcpy ((char *) dirp->dirname, cp, len)) = '\0';
479
          // ADDED BY THEY4KMAN (1/24/2010): free(cp) the copy we've created
480
          // with expand_dynamic_string_token above.
481
          free(cp);
471
	  dirp->dirnamelen = len;
482
	  dirp->dirnamelen = len;
472
483
473
	  if (len > max_dirnamelen)
484
	  if (len > max_dirnamelen)
Lines 551-557 decompose_rpath (struct r_search_path_struct *sps, Link Here
551
562
552
  /* Make a writable copy.  At the same time expand possible dynamic
563
  /* Make a writable copy.  At the same time expand possible dynamic
553
     string tokens.  */
564
     string tokens.  */
554
  copy = expand_dynamic_string_token (l, rpath);
565
// CHANGED BY THEY4KMAN (1/24/2010): we want to replace variables AFTER
566
//   splitting the path with colons.
567
//  copy = expand_dynamic_string_token (l, rpath);
568
  copy = local_strdup(rpath);
555
  if (copy == NULL)
569
  if (copy == NULL)
556
    {
570
    {
557
      errstring = N_("cannot create RUNPATH/RPATH copy");
571
      errstring = N_("cannot create RUNPATH/RPATH copy");
Lines 576-582 decompose_rpath (struct r_search_path_struct *sps, Link Here
576
      _dl_signal_error (ENOMEM, NULL, NULL, errstring);
590
      _dl_signal_error (ENOMEM, NULL, NULL, errstring);
577
    }
591
    }
578
592
579
  fillin_rpath (copy, result, ":", 0, what, where);
593
  fillin_rpath (copy, result, ":", 0, what, where, l);
580
594
581
  /* Free the copied RPATH string.  `fillin_rpath' make own copies if
595
  /* Free the copied RPATH string.  `fillin_rpath' make own copies if
582
     necessary.  */
596
     necessary.  */
Lines 775-781 _dl_init_paths (const char *llp) Link Here
775
789
776
      (void) fillin_rpath (llp_tmp, env_path_list.dirs, ":;",
790
      (void) fillin_rpath (llp_tmp, env_path_list.dirs, ":;",
777
			   INTUSE(__libc_enable_secure), "LD_LIBRARY_PATH",
791
			   INTUSE(__libc_enable_secure), "LD_LIBRARY_PATH",
778
			   NULL);
792
			   NULL,
793
#ifdef SHARED
794
                           l);
795
#else
796
                           NULL);
797
#endif
779
798
780
      if (env_path_list.dirs[0] == NULL)
799
      if (env_path_list.dirs[0] == NULL)
781
	{
800
	{

Return to bug 10253