diff options
author | larrybr <larrybr@noemail.net> | 2023-04-25 04:28:39 +0000 |
---|---|---|
committer | larrybr <larrybr@noemail.net> | 2023-04-25 04:28:39 +0000 |
commit | 38c2052767df63ced5b3d96c46844f6a8d28a86f (patch) | |
tree | 2450d7cbf603450a1fa595028f54687e99d13508 /ext/misc/base64.c | |
parent | 21461407f64ef6b81b3d76ab4a23f07ececd0c1d (diff) | |
download | sqlite-38c2052767df63ced5b3d96c46844f6a8d28a86f.tar.gz sqlite-38c2052767df63ced5b3d96c46844f6a8d28a86f.zip |
Handle newline-trimmed input TEXT correctly in base64, base85 UDFs.
FossilOrigin-Name: 8f637aae23e6638c064a34262dcf16a3cdfd000fb1fa1b2a834b292fe6659408
Diffstat (limited to 'ext/misc/base64.c')
-rw-r--r-- | ext/misc/base64.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/misc/base64.c b/ext/misc/base64.c index 25e76a5e9..bc7a976ab 100644 --- a/ext/misc/base64.c +++ b/ext/misc/base64.c @@ -148,9 +148,9 @@ static char* toBase64( u8 *pIn, int nbIn, char *pOut ){ } /* Skip over text which is not base64 numeral(s). */ -static char * skipNonB64( char *s ){ +static char * skipNonB64( char *s, int nc ){ char c; - while( (c = *s) && !IS_BX_DIGIT(BX_DV_PROTO(c)) ) ++s; + while( nc-- > 0 && (c = *s) && !IS_BX_DIGIT(BX_DV_PROTO(c)) ) ++s; return s; } @@ -159,7 +159,7 @@ static u8* fromBase64( char *pIn, int ncIn, u8 *pOut ){ if( ncIn>0 && pIn[ncIn-1]=='\n' ) --ncIn; while( ncIn>0 && *pIn!=PAD_CHAR ){ static signed char nboi[] = { 0, 0, 1, 2, 3 }; - char *pUse = skipNonB64(pIn); + char *pUse = skipNonB64(pIn, ncIn); unsigned long qv = 0L; int nti, nbo, nac; ncIn -= (pUse - pIn); |