Skip to content

Commit

Permalink
mktmp: fix off by one
Browse files Browse the repository at this point in the history
Reported in:

#41

Thanks @tduccuong!
  • Loading branch information
msantos committed Oct 17, 2017
1 parent 69f476e commit 032cc0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/procket.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@
[{description, "Low level socket operations"},
{applications, []},
{registered, []},
{vsn, "0.9.3"},

{licenses, ["BSD-3"]},
{vsn, "0.9.2"}]}.
{maintainers, ["Michael Santos"]},
{links, [
{"Github", "https://github.com/msantos/procket"}
]}
]}.
4 changes: 2 additions & 2 deletions src/procket_mktmp.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Copyright (c) 2010-2015, Michael Santos <[email protected]>
%% Copyright (c) 2010-2017, Michael Santos <[email protected]>
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -60,7 +60,7 @@ template(Name, Chars) ->
template(lists:reverse(Name), [], Chars).
template([$X|Rest], Acc, Chars) ->
template(Rest,
[lists:nth(rand:uniform(length(Chars)+1), Chars)|Acc],
[lists:nth(rand:uniform(length(Chars)), Chars)|Acc],
Chars);
template(Name, Rand, _) when length(Rand) >= 6 ->
lists:reverse(Name) ++ Rand.
Expand Down

0 comments on commit 032cc0f

Please sign in to comment.