Tcl Source Code

Artifact [264ae57d64]
Login

Artifact 264ae57d6455292a87251e0e642fe98fd9418984147a38a0e3f9f3b2789aa23b:

Attachment "cd_crash.c" to ticket [e2698b94b1] added by jmroot 2026-04-14 23:48:41. (unpublished)
#include <sys/types.h>
#include <pwd.h>
#include <uuid/uuid.h>
#include <unistd.h>
#include <tcl.h>

int main(void)
{
    Tcl_Interp *interp = Tcl_CreateInterp();
    struct passwd *pwent = getpwnam("nobody");
    Tcl_Obj *pathobj = Tcl_NewStringObj("/", -1);
    Tcl_IncrRefCount(pathobj);
    Tcl_Obj *cwdobj = Tcl_FSGetCwd(interp);
    setegid(pwent->pw_gid);
    seteuid(pwent->pw_uid);
    cwdobj = Tcl_FSGetCwd(interp);
    Tcl_FSChdir(pathobj);
    return 0;
}