r70763 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70762‎ | r70763 | r70764 >
Date:13:59, 9 August 2010
Author:platonides
Status:deferred
Tags:
Comment:
Allow requesting arbitrarily large passwords.
Zero the password buffer after it has been echoed.
svn:ignore the binaries
Modified paths:
  • /trunk/tools/mkpass (modified) (history)
  • /trunk/tools/mkpass/mkpass.c (modified) (history)

Diff [purge]

Index: trunk/tools/mkpass/mkpass.c
@@ -31,8 +31,8 @@
3232 int f, i, len;
3333 char *d, *r;
3434 len = av[1] ? atoi(av[1]) : DEFLEN;
35 - if (len < 1 || len > 16) {
36 - fprintf(stderr, "length must be between 1 and 16\n");
 35+ if ( len < 1 ) {
 36+ fprintf(stderr, "length must be at least 1\n");
3737 return 1;
3838 }
3939 if ((f = open("/dev/random", O_RDONLY)) == -1) {
@@ -47,10 +47,11 @@
4848 }
4949 close(f);
5050 r = malloc(len + 1);
51 - bzero(r, len + 1);
5251 for (i = 0; i < len; ++i)
5352 r[i] = pwchars[d[i] % (sizeof(pwchars) - 1)];
 53+ r[i] = '\0';
5454 fputs(r, stdout);
 55+ bzero(r, len + 1);
5556 fputs("\n", stdout);
5657 return 0;
5758 }
Property changes on: trunk/tools/mkpass
___________________________________________________________________
Added: svn:ignore
5859 + mkpass
mkpass.exe

Status & tagging log