a few security fixes

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@219 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Joshua Kwan 2004-02-02 23:28:17 +00:00
parent f0efefec2f
commit 39100e0631
2 changed files with 7 additions and 7 deletions

View File

@ -866,7 +866,7 @@ loginprompt (int from_ttyplay)
void
newuser ()
{
char buf[1024];
char buf[1024], dirname[100];
int error = 2;
unsigned int i;
@ -984,6 +984,11 @@ newuser ()
snprintf (rcfilename, 80, "%srcfiles/%s.nethackrc", myconfig->dglroot, me->username);
write_canned_rcfile (rcfilename);
/* create their ttyrec dir */
snprintf (dirname, 100, "%sttyrec/%s", myconfig->dglroot, me->username);
if (access (dirname, F_OK) != 0)
mkdir (dirname, 0755);
writefile (1);
}
@ -1480,7 +1485,7 @@ main (int argc, char** argv)
unsigned int len;
int c;
while ((c = getopt(argc, argv, "qh:p:f:")) != -1)
while ((c = getopt(argc, argv, "qh:pp:f:")) != -1)
{
switch (c)
{

View File

@ -86,11 +86,6 @@ ttyrec_main (char *username, char* ttyrec_filename)
{
char dirname[100];
snprintf (dirname, 100, "%sttyrec/%s", myconfig->dglroot, username);
if (access (dirname, F_OK) != 0)
mkdir (dirname, 0755);
snprintf (dirname, 100, "%sttyrec/%s/%s", myconfig->dglroot, username,
ttyrec_filename);