Fix non-0 terminated hostname str
This commit is contained in:
parent
b01309c3bf
commit
5d90d8930e
@ -69,8 +69,9 @@ void prepareHostname(char* hostname)
|
|||||||
if (pos < 6) {
|
if (pos < 6) {
|
||||||
sprintf(hostname + 5, "%*s", 6, escapedMac.c_str() + 6);
|
sprintf(hostname + 5, "%*s", 6, escapedMac.c_str() + 6);
|
||||||
} else { //last character must not be hyphen
|
} else { //last character must not be hyphen
|
||||||
|
hostname[pos] = '\0'; // terminate string
|
||||||
while (pos > 0 && hostname[pos -1] == '-') {
|
while (pos > 0 && hostname[pos -1] == '-') {
|
||||||
hostname[pos -1] = 0;
|
hostname[pos -1] = '\0';
|
||||||
pos--;
|
pos--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user