mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-27 03:51:16 -05:00
improve error handling in sig_fromfile
(cherry picked from commit 52c5b74c27)
This commit is contained in:
parent
97e241a3f8
commit
82cd68fdf9
1 changed files with 9 additions and 4 deletions
|
|
@ -673,23 +673,28 @@ sig_fromfile(char *path, isc_buffer_t *iscbuf) {
|
|||
|
||||
p = buf;
|
||||
len = size;
|
||||
while(len) {
|
||||
while (len > 0) {
|
||||
if ((*p == '\r') || (*p == '\n')) {
|
||||
++p;
|
||||
--len;
|
||||
continue;
|
||||
}
|
||||
} else if (len < 2)
|
||||
return (1);
|
||||
if (('0' <= *p) && (*p <= '9'))
|
||||
val = *p - '0';
|
||||
else
|
||||
else if (('A' <= *p) && (*p <= 'F'))
|
||||
val = *p - 'A' + 10;
|
||||
else
|
||||
return (1);
|
||||
++p;
|
||||
val <<= 4;
|
||||
--len;
|
||||
if (('0' <= *p) && (*p <= '9'))
|
||||
val |= (*p - '0');
|
||||
else
|
||||
else if (('A' <= *p) && (*p <= 'F'))
|
||||
val |= (*p - 'A' + 10);
|
||||
else
|
||||
return (1);
|
||||
++p;
|
||||
--len;
|
||||
isc_buffer_putuint8(iscbuf, val);
|
||||
|
|
|
|||
Loading…
Reference in a new issue