Skip to content

Commit 1491f1c

Browse files
committed
add check for incorrect root redirect from webem action
1 parent 7595a40 commit 1491f1c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

webserver/cWebem.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,16 @@ bool cWebem::CheckForAction(WebEmSession & session, request& req )
382382
catch (...)
383383
{
384384

385+
}
386+
if ((req.uri[0] == '/') && (m_webRoot.length() > 0))
387+
{
388+
// possible incorrect root reference
389+
size_t q = req.uri.find(m_webRoot);
390+
if (q != 0)
391+
{
392+
std::string olduri = req.uri;
393+
req.uri = m_webRoot + olduri;
394+
}
385395
}
386396
return true;
387397
}
@@ -431,6 +441,16 @@ bool cWebem::CheckForAction(WebEmSession & session, request& req )
431441
{
432442

433443
}
444+
if ((req.uri[0] == '/') && (m_webRoot.length() > 0))
445+
{
446+
// possible incorrect root reference
447+
size_t q = req.uri.find(m_webRoot);
448+
if (q != 0)
449+
{
450+
std::string olduri = req.uri;
451+
req.uri = m_webRoot + olduri;
452+
}
453+
}
434454

435455
return true;
436456
}

0 commit comments

Comments
 (0)