Nikita Popov
5b3f4d25ea
Fix memory allocation checks for base64 encode
...
base64_encode used safe_emalloc, but one of the arguments was derived from a
multiplication, thus making the allocation unsafe again.
There was a size check in place, but it was off by a factor of two as it
didn't account for the signedness of the integer type.
The unsafe allocation is not exploitable, but still causes funny behavior
when the sized overflows into a negative number.
To fix the issue the *4 factor is moved into the size argument (where it is
known to be safe), so safe_emalloc can carry out the multiplication.
The size check is removed as it doesn't really make sense once safe_emalloc
works correctly. (Would only cause base64_encode to silently return false
instead of throwing an error. Also could cause problems with other uses of
the base64 encoding API, which all don't check for a NULL return value.)
Furthermore the (length + 2) < 0 check is replaced with just length < 0.
Allowing lengths -2 and -1 doesn't make sense semantically and also is not
honored in the following code (negative length would access unallocated
memory.)
Actually the length < 0 check doesn't make sense altogether, but I left it
there just to be safe.
2012-06-24 23:32:50 +02:00
..
2012-06-07 17:44:20 +02:00
2012-05-06 20:01:10 +08:00
2012-01-01 13:15:04 +00:00
2012-06-24 23:32:50 +02:00
2012-01-01 13:15:04 +00:00
2012-03-12 16:53:07 +00:00
2012-01-01 13:15:04 +00:00
2012-06-22 17:32:46 +02:00
2010-06-17 10:22:03 +00:00
2010-12-13 18:43:10 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2010-12-17 10:49:02 +00:00
2010-05-27 22:51:28 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2011-07-18 21:26:29 +00:00
2011-07-18 21:26:29 +00:00
2012-05-29 23:07:04 -07:00
2008-08-25 14:37:07 +00:00
2011-07-31 21:47:03 +00:00
2011-07-31 23:14:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2011-09-04 21:48:22 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-03-08 12:30:59 +00:00
2012-05-10 15:27:44 +02:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-05-08 18:31:11 +02:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-04-29 19:12:12 -03:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-03-25 05:32:21 +05:30
2012-01-01 13:15:04 +00:00
2012-05-11 13:07:00 -04:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-04-23 22:09:38 +01:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-05-16 16:35:16 +02:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-05-30 14:42:39 +08:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-02-24 22:56:21 +00:00
2012-01-01 13:15:04 +00:00
2012-03-02 03:39:04 +00:00
2009-09-28 13:29:53 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2011-07-28 10:52:45 +00:00
2012-01-01 13:15:04 +00:00
2011-07-28 10:52:45 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2012-01-01 13:15:04 +00:00
2008-12-09 17:57:59 +00:00