Mercurial > hg > mlmmj
comparison src/strgen.c @ 731:e29893b9f581
Make the random strings produced always the same length rather the
smaller random numbers producing shorter strings which could be
problematic
author | Ben Schmidt |
---|---|
date | Sat, 31 Jul 2010 00:26:30 +1000 |
parents | a81c74ff2995 |
children | dd5b87ddd51e |
comparison
equal
deleted
inserted
replaced
730:793e5b2b28f2 | 731:e29893b9f581 |
---|---|
38 #include "memory.h" | 38 #include "memory.h" |
39 #include "log_error.h" | 39 #include "log_error.h" |
40 | 40 |
41 char *random_str() | 41 char *random_str() |
42 { | 42 { |
43 size_t len = 128; | 43 size_t len = 17; |
44 char *dest = mymalloc(len); | 44 char *dest = mymalloc(len); |
45 | 45 |
46 snprintf(dest, len, "%x%x", random_int(), random_int()); | 46 snprintf(dest, len, "%08x%08x", random_int(), random_int()); |
47 | 47 |
48 return dest; | 48 return dest; |
49 } | 49 } |
50 | 50 |
51 char *random_plus_addr(const char *addr) | 51 char *random_plus_addr(const char *addr) |