# HG changeset patch # User Ben Schmidt # Date 1280499990 -36000 # Node ID e29893b9f5810275da91bd67bd091858f283f995 # Parent 793e5b2b28f29c2c3db52531da3dfc1402dd6522 Make the random strings produced always the same length rather the smaller random numbers producing shorter strings which could be problematic diff -r 793e5b2b28f2 -r e29893b9f581 ChangeLog --- a/ChangeLog Sat Jul 31 00:25:36 2010 +1000 +++ b/ChangeLog Sat Jul 31 00:26:30 2010 +1000 @@ -1,3 +1,6 @@ + o Makes the random strings produced always the same length rather the + smaller random numbers producing shorter strings which could be + problematic o Make random number generation more efficient by only seeding the generator once o Added feature to notify users when their posts are moderated diff -r 793e5b2b28f2 -r e29893b9f581 src/strgen.c --- a/src/strgen.c Sat Jul 31 00:25:36 2010 +1000 +++ b/src/strgen.c Sat Jul 31 00:26:30 2010 +1000 @@ -40,10 +40,10 @@ char *random_str() { - size_t len = 128; + size_t len = 17; char *dest = mymalloc(len); - snprintf(dest, len, "%x%x", random_int(), random_int()); + snprintf(dest, len, "%08x%08x", random_int(), random_int()); return dest; }