Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/webcfg_multipart.c
Original file line number Diff line number Diff line change
Expand Up @@ -2306,6 +2306,21 @@ void checkValidURL(char **s) {
{
// If the MAC address is not empty
WebcfgDebug("URL is having valid MAC Address.\n");

// Validate if the MAC is correct for the box
const char *mac = get_deviceMAC();
if (mac != NULL && strncmp(mac, start, 12) != 0)
{
WebcfgError("MAC Address in URL does not match actual device MAC. Updating...\n");
strncpy(modified_url, *s, start - *s);
modified_url[start - *s] = '\0';
strncat(modified_url, mac, sizeof(modified_url) - strlen(modified_url) - 1);
strncat(modified_url, "/config", sizeof(modified_url) - strlen(modified_url) - 1);
modified_url[sizeof(modified_url) - 1] = '\0';
WEBCFG_FREE(*s);
*s = strdup(modified_url);
WebcfgInfo("Updated URL: %s\n", *s);
}
}
}
}
Expand Down
Loading