VirtualBox

Changeset 29636 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 18, 2010 1:43:55 PM (15 years ago)
Author:
vboxsync
Message:

Runtime/process-posix: consume less stack during RTProcCreateEx

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/process-posix.cpp

    r29624 r29636  
    6464#include <iprt/socket.h>
    6565#include <iprt/string.h>
     66#include <iprt/mem.h>
    6667#include "internal/process.h"
    6768
     
    9495        pw->pw_passwd = spwd->sp_pwdp;
    9596
    96     struct crypt_data data;
    97     char *pszEncPasswd = crypt_r(pszPasswd, pw->pw_passwd, &data);
     97    /* be reentrant */
     98    struct crypt_data *data = (struct crypt_data*)RTMemTmpAllocZ(sizeof(*data));
     99    char *pszEncPasswd = crypt_r(pszPasswd, pw->pw_passwd, data);
    98100    if (strcmp(pszEncPasswd, pw->pw_passwd))
    99101        return VERR_PERMISSION_DENIED;
     102    RTMemTmpFree(data);
    100103
    101104    *gid = pw->pw_gid;
    102105    *uid = pw->pw_uid;
    103106    return VINF_SUCCESS;
     107
    104108#elif defined(RT_OS_SOLARIS)
    105109    struct passwd *ppw, pw;
     
    125129    *uid = ppw->pw_uid;
    126130    return VINF_SUCCESS;
     131
    127132#else
    128133    return VERR_PERMISSION_DENIED;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette