pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:3250:    *! The second syntax is used to verify @[typed_password] against    *! @[crypted_password], and returns @expr{1@} if they match, and    *! @expr{0@} (zero) otherwise.    *!    *! @note    *! Note that strings containing null characters will only be    *! processed up until the null character.    */   PMOD_EXPORT void f_crypt(INT32 args)   { -  char salt[2]; +  char salt[3];    char *ret, *pwd, *saltp = NULL;    char *choise =    "cbhisjKlm4k65p7qrJfLMNQOPxwzyAaBDFgnoWXYCZ0123tvdHueEGISRTUV89./";       get_all_args("crypt", args, "%s.%s", &pwd, &saltp);       if(saltp)    {    if( Pike_sp[1-args].u.string->len < 2 )    {    pop_n_elems(args);    push_int(0);    return;    }    } else {    unsigned int foo; /* Sun CC wants this :( */    foo=my_rand();    salt[0] = choise[foo % (size_t) strlen(choise)];    foo=my_rand();    salt[1] = choise[foo % (size_t) strlen(choise)]; -  +  salt[2] = 0;    saltp=salt;    if (args > 1) {    pop_n_elems(args-1);    args = 1;    }    }   #ifdef HAVE_CRYPT    ret = (char *)crypt(pwd, saltp);   #else   #ifdef HAVE__CRYPT