mirror of
https://github.com/cathugger/mkp224o.git
synced 2025-01-09 11:07:19 -03:00
stronger base64 validation
This commit is contained in:
parent
832ff7bdfb
commit
ee0257dc88
1 changed files with 2 additions and 2 deletions
|
@ -84,10 +84,10 @@ int base64_valid(const char *src,size_t *count)
|
||||||
for (p = src;base64f[(u8)*p] != 0xFF;++p)
|
for (p = src;base64f[(u8)*p] != 0xFF;++p)
|
||||||
;
|
;
|
||||||
|
|
||||||
for (;*p == '=';++p)
|
for (;((size_t) (p - src)) % 4 != 0 && *p == '=';++p)
|
||||||
;
|
;
|
||||||
|
|
||||||
if (count)
|
if (count)
|
||||||
*count = (size_t) (p - src);
|
*count = (size_t) (p - src);
|
||||||
return !*p;
|
return !*p && ((size_t) (p - src)) % 4 == 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue