mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Tidy previous commit.
This commit is contained in:
17
src/tftp.c
17
src/tftp.c
@@ -529,13 +529,7 @@ void check_tftp_listeners(fd_set *rset, time_t now)
|
|||||||
if (!err)
|
if (!err)
|
||||||
err = "";
|
err = "";
|
||||||
else
|
else
|
||||||
{
|
sanitise(err);
|
||||||
unsigned char *q, *r;
|
|
||||||
for (q = r = (unsigned char *)err; *r; r++)
|
|
||||||
if (isprint(*r))
|
|
||||||
*(q++) = *r;
|
|
||||||
*q = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
my_syslog(MS_TFTP | LOG_ERR, _("error %d %s received from %s"),
|
my_syslog(MS_TFTP | LOG_ERR, _("error %d %s received from %s"),
|
||||||
(int)ntohs(mess->block), err,
|
(int)ntohs(mess->block), err,
|
||||||
@@ -620,11 +614,12 @@ static char *next(char **p, char *end)
|
|||||||
|
|
||||||
static void sanitise(char *buf)
|
static void sanitise(char *buf)
|
||||||
{
|
{
|
||||||
char *end = buf + strlen(buf);
|
unsigned char *q, *r;
|
||||||
|
for (q = r = (unsigned char *)buf; *r; r++)
|
||||||
|
if (isprint(*r))
|
||||||
|
*(q++) = *r;
|
||||||
|
*q = 0;
|
||||||
|
|
||||||
while (*(buf++))
|
|
||||||
if (!isprint(*buf))
|
|
||||||
memmove(buf, buf + 1, end - buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t tftp_err(int err, char *packet, char *message, char *file)
|
static ssize_t tftp_err(int err, char *packet, char *message, char *file)
|
||||||
|
|||||||
Reference in New Issue
Block a user