X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Futilities.c;h=92987471558d60f130020faf800f42740ccd64fd;hb=6bc6cf720913ae042f36e62e09abce7d340607ab;hp=52f46b40562fc55b1bcc5b4b79ea1944de643cd8;hpb=14563e0f4a2840f6a038fc9fd44ae8bd48206be6;p=awesomized%2Flibmemcached diff --git a/clients/utilities.c b/clients/utilities.c index 52f46b40..92987471 100644 --- a/clients/utilities.c +++ b/clients/utilities.c @@ -71,9 +71,10 @@ static const char *lookup_help(memcached_options option) void help_command(const char *command_name, const char *description, const struct option *long_options, - memcached_programs_help_st *options __attribute__((unused))) + memcached_programs_help_st *options) { unsigned int x; + (void)options; printf("%s v%u.%u\n\n", command_name, 1U, 0U); printf("\t%s\n\n", description); @@ -148,7 +149,7 @@ static int get_password(sasl_conn_t *conn, void *context, int id, sasl_secret_t **psecret) { (void)context; - static sasl_secret_t* x; + static sasl_secret_t* ptr; if (!conn || ! psecret || id != SASL_CB_PASS) return SASL_BADPARAM; @@ -160,14 +161,15 @@ static int get_password(sasl_conn_t *conn, void *context, int id, } size_t len= strlen(passwd); - x = realloc(x, sizeof(sasl_secret_t) + len); - if (!x) + ptr= malloc(sizeof(sasl_secret_t) + len +1); + if (! ptr) return SASL_NOMEM; - x->len = len; - strcpy((void *)x->data, passwd); + ptr->len= len; + memcpy(ptr->data, passwd, len); + ptr->data[len]= 0; - *psecret = x; + *psecret= ptr; return SASL_OK; }