Skip to content

Commit ad1b520

Browse files
author
Laurent LEVIER
committed
Major bug in gen_mac function. preg_replace ff to fa was using an expression. Using str_replace instead
1 parent e96f7f1 commit ad1b520

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

bin/gns3-optimize

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ function gen_uuid() {
561561
function gen_mac()
562562
{
563563
$md5_str=md5(random_int(0,0xffffff));
564-
$md5_str=preg_replace('/ff/','/fa/',$md5_str);
564+
$md5_str=str_replace('ff','fa',$md5_str);
565565
$mac=str_split($md5_str,2);
566566

567567
return sprintf( '02:%s:%s:%s:%s:%s',$mac[0],$mac[1],$mac[2],$mac[3],$mac[4]);

bin/project-lowlevel-clone-ZFS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ if (!function_exists(gen_mac))
156156
function gen_mac()
157157
{
158158
$md5_str=md5(random_int(0,0xffffff));
159-
$md5_str=preg_replace('/ff/','/fa/',$md5_str);
159+
$md5_str=str_replace('ff','fa',$md5_str);
160160
$mac=str_split($md5_str,2);
161161

162162
return sprintf( '02:%s:%s:%s:%s:%s',$mac[0],$mac[1],$mac[2],$mac[3],$mac[4]);

bin/project-lowlevel-reset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ if (!function_exists('report'))
4646
function gen_mac()
4747
{
4848
$md5_str=md5(random_int(0,0xffffff));
49-
$md5_str=preg_replace('/ff/','/fa/',$md5_str);
49+
$md5_str=str_replace('ff','fa',$md5_str);
5050
$mac=str_split($md5_str,2);
5151

5252
return sprintf( '02:%s:%s:%s:%s:%s',$mac[0],$mac[1],$mac[2],$mac[3],$mac[4]);

0 commit comments

Comments
 (0)