Skip to content

Commit

Permalink
Properly return the length.
Browse files Browse the repository at this point in the history
  • Loading branch information
meh committed Jun 14, 2012
1 parent 9c81c2c commit dfeae5a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nucular/security.d
Original file line number Diff line number Diff line change
Expand Up @@ -848,10 +848,11 @@ private extern (C):
int _password_callback (char* buf, int bufsize, int rwflag, void* userdata)
{
char* password = cast (char*) userdata;
int length = strlen(password).to!int;

strncpy(buf, password, bufsize - 1);

return strlen(password).to!int;
return length >= bufsize ? bufsize - 1 : length;
}

int _verify_callback (int preverify_ok, X509_STORE_CTX* ctx)
Expand Down

0 comments on commit dfeae5a

Please sign in to comment.