Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit10a81b3

Browse files
committed
Fix combo_decrypt() to throw an error for zero-length input when using a
padded encryption scheme. Formerly it would try to access res[(unsigned) -1],which resulted in core dumps on 64-bit machines, and was certainly troublewaiting to happen on 32-bit machines (though in at least the known caseit was harmless because that byte would be overwritten after return).Per report from Ken Colson; fix by Marko Kreen.
1 parentffaaaf9 commit10a81b3

File tree

1 file changed

+13
-1
lines changed
  • contrib/pgcrypto

1 file changed

+13
-1
lines changed

‎contrib/pgcrypto/px.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2727
* SUCH DAMAGE.
2828
*
29-
* $Id: px.c,v 1.7 2002/03/06 06:09:10 momjian Exp $
29+
* $Id: px.c,v 1.7.2.1 2007/08/23 16:16:27 tgl Exp $
3030
*/
3131

3232
#include<postgres.h>
@@ -185,6 +185,18 @@ combo_decrypt(PX_Combo * cx, const uint8 *data, unsigned dlen,
185185

186186
PX_Cipher*c=cx->cipher;
187187

188+
/* decide whether zero-length input is allowed */
189+
if (dlen==0)
190+
{
191+
/* with padding, empty ciphertext is not allowed */
192+
if (cx->padding)
193+
return-1;
194+
195+
/* without padding, report empty result */
196+
*rlen=0;
197+
return0;
198+
}
199+
188200
bs=px_cipher_block_size(c);
189201
if (bs>1&& (dlen %bs)!=0)
190202
gotoblock_error;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp