Index: trunk/tools/mkpass/mkpass.c |
— | — | @@ -31,8 +31,8 @@ |
32 | 32 | int f, i, len; |
33 | 33 | char *d, *r; |
34 | 34 | 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"); |
37 | 37 | return 1; |
38 | 38 | } |
39 | 39 | if ((f = open("/dev/random", O_RDONLY)) == -1) { |
— | — | @@ -47,10 +47,11 @@ |
48 | 48 | } |
49 | 49 | close(f); |
50 | 50 | r = malloc(len + 1); |
51 | | - bzero(r, len + 1); |
52 | 51 | for (i = 0; i < len; ++i) |
53 | 52 | r[i] = pwchars[d[i] % (sizeof(pwchars) - 1)]; |
| 53 | + r[i] = '\0'; |
54 | 54 | fputs(r, stdout); |
| 55 | + bzero(r, len + 1); |
55 | 56 | fputs("\n", stdout); |
56 | 57 | return 0; |
57 | 58 | } |
Property changes on: trunk/tools/mkpass |
___________________________________________________________________ |
Added: svn:ignore |
58 | 59 | + mkpass |
mkpass.exe |