Changeset 3186 for trunk/src/kmk/main.c


Ignore:
Timestamp:
Mar 23, 2018, 11:44:44 PM (7 years ago)
Author:
bird
Message:

kmk: replaced w32ify() as it uses unsafe static buffer and encourages buffer size assumptions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/main.c

    r3170 r3186  
    12421242      batch_mode_shell = 1;
    12431243      unixy_shell = 0;
     1244# if 1  /* bird: sprintf? wtf. */
     1245      default_shell = unix_slashes (xstrdup (search_token));
     1246# else
    12441247      sprintf (sh_path, "%s", search_token);
    12451248      default_shell = xstrdup (w32ify (sh_path, 0));
     1249# endif
    12461250      DB (DB_VERBOSE, (_("find_and_set_shell() setting default_shell = %s\n"),
    12471251                       default_shell));
     
    12571261    {
    12581262      /* search token path was found */
     1263# if 1  /* bird: sprintf? wtf. */
     1264      default_shell = unix_slashes (xstrdup (search_token));
     1265# else
    12591266      sprintf (sh_path, "%s", search_token);
    12601267      default_shell = xstrdup (w32ify (sh_path, 0));
     1268# endif
    12611269      DB (DB_VERBOSE, (_("find_and_set_shell() setting default_shell = %s\n"),
    12621270                       default_shell));
     
    12801288              *ep = '\0';
    12811289
     1290# if 1 /* bird: insanity insurance */
     1291              _snprintf (sh_path, GET_PATH_MAX, "%s/%s", p, search_token);
     1292# else
    12821293              sprintf (sh_path, "%s/%s", p, search_token);
     1294# endif
    12831295              if (_access (sh_path, 0) == 0)
    12841296                {
     1297# if 1  /* bird: we can modify sh_path directly. */
     1298                  default_shell = xstrdup (unix_slashes (sh_path));
     1299# else
    12851300                  default_shell = xstrdup (w32ify (sh_path, 0));
     1301# endif
    12861302                  sh_found = 1;
    12871303                  *ep = PATH_SEPARATOR_CHAR;
     
    13021318          if (p && *p)
    13031319            {
     1320# if 1 /* bird: insanity insurance */
     1321              _snprintf (sh_path, GET_PATH_MAX, "%s/%s", p, search_token);
     1322# else
    13041323              sprintf (sh_path, "%s/%s", p, search_token);
     1324# endif
    13051325              if (_access (sh_path, 0) == 0)
    13061326                {
     1327# if 1  /* bird: we can modify sh_path directly. */
     1328                  default_shell = xstrdup (unix_slashes (sh_path));
     1329# else
    13071330                  default_shell = xstrdup (w32ify (sh_path, 0));
     1331# endif
    13081332                  sh_found = 1;
    13091333                }
     
    21302154  if (strpbrk (argv[0], "/:\\") || strstr (argv[0], "..")
    21312155      || strneq (argv[0], "//", 2))
    2132     argv[0] = xstrdup (w32ify (argv[0], 1));
     2156# if 1  /* bird */
     2157    {
     2158      PATH_VAR (tmp_path_buf);
     2159      argv[0] = xstrdup (unix_slashes_resolved (argv[0], tmp_path_buf,
     2160                                                GET_PATH_MAX));
     2161    }
     2162# else  /* bird */
     2163      //argv[0] = xstrdup (w32ify (argv[0], 1));
     2164# endif /* bird */
    21332165#else /* WINDOWS32 */
    21342166#if defined (__MSDOS__) || defined (__EMX__)
Note: See TracChangeset for help on using the changeset viewer.