base64.c (189261) | base64.c (209158) |
---|---|
1/* 2 * Base64 encoding/decoding (RFC1341) 3 * Copyright (c) 2005, Jouni Malinen <j@w1.fi> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License version 2 as 7 * published by the Free Software Foundation. 8 * --- 29 unchanged lines hidden (view full) --- 38 unsigned char *out, *pos; 39 const unsigned char *end, *in; 40 size_t olen; 41 int line_len; 42 43 olen = len * 4 / 3 + 4; /* 3-byte blocks to 4-byte */ 44 olen += olen / 72; /* line feeds */ 45 olen++; /* nul termination */ | 1/* 2 * Base64 encoding/decoding (RFC1341) 3 * Copyright (c) 2005, Jouni Malinen <j@w1.fi> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License version 2 as 7 * published by the Free Software Foundation. 8 * --- 29 unchanged lines hidden (view full) --- 38 unsigned char *out, *pos; 39 const unsigned char *end, *in; 40 size_t olen; 41 int line_len; 42 43 olen = len * 4 / 3 + 4; /* 3-byte blocks to 4-byte */ 44 olen += olen / 72; /* line feeds */ 45 olen++; /* nul termination */ |
46 if (olen < len) 47 return NULL; /* integer overflow */ |
|
46 out = os_malloc(olen); 47 if (out == NULL) 48 return NULL; 49 50 end = src + len; 51 in = src; 52 pos = out; 53 line_len = 0; --- 134 unchanged lines hidden --- | 48 out = os_malloc(olen); 49 if (out == NULL) 50 return NULL; 51 52 end = src + len; 53 in = src; 54 pos = out; 55 line_len = 0; --- 134 unchanged lines hidden --- |