Changeset 13 for trunk


Ignore:
Timestamp:
Dec 17, 2005, 4:16:47 PM (14 years ago)
Author:
jtv
Message:

More randomness in session ID

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ui_web.c

    r11 r13  
    6161int main(void)
    6262{
    63   char id[idlen+1];
     63  char id[idlen*2];
    6464  char filename[300];
    6565  int rows=0, cols=0, mines=0, intelligence=mines_max_intelligence();
     
    154154  else if (rows && cols && mines && rows*cols<=maxsize)
    155155  {
     156    size_t idbytes = 0;
     157
    156158    /* We have parameters.  Create new game. */
    157159    seed_randomizer();
    158     sprintf(id,"%*.*x",idlen,idlen,rand());
     160    do
     161    {
     162      sprintf(id+idbytes,"%*.*x",4,4,rand());
     163      idbytes = strlen(id);
     164    } while (idbytes < idlen);
     165    id[idlen] = '\0';
    159166    F = mines_init(rows,cols,mines);
    160167    if (!F) exit(1);
Note: See TracChangeset for help on using the changeset viewer.