pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:3582:    *!    *! The third syntax generates a random string and then crypts it,    *! creating a string useful as a password.    *!    *! @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 = NULL, *saltp = NULL;    char *alphabet =    "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";   #ifdef HAVE_CRYPT_R    struct crypt_data crypt_data;    crypt_data.initialized = 0;   #endif       get_all_args("crypt", args, ".%s%s", &pwd, &saltp);   
pike.git/src/builtin_functions.c:3624:    simple_mapping_string_lookup(get_builtin_constants(), "random");    if(!random || (TYPEOF(*random) != T_FUNCTION))    Pike_error("Unable to resolve random function.\n");    push_int(4096); /* strlen(alphbet)**2 */    apply_svalue(random, 1);    if(TYPEOF(Pike_sp[-1])!=T_INT)    Pike_error("Couldn't generate random number.\n");       salt[0] = alphabet[ Pike_sp[-1].u.integer & 0x3f ];    salt[1] = alphabet[ (Pike_sp[-1].u.integer>>6) & 0x3f ]; +  salt[2] = 0;    pop_stack();       saltp=salt;    if (args > 1) {    pop_n_elems(args-1);    args = 1;    }    }       /* NB: crypt(3C) with modern algorithms may be quite slow,