Skip site navigation (1) Skip section navigation (2)

arrayfuncs: fix read of uninitialized mem

From: Neil Conway <neilc(at)samurai(dot)com>
To: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: arrayfuncs: fix read of uninitialized mem
Date: 2004-09-15 07:48:02
Message-ID: 1095234481.29728.47.camel@localhost.localdomain (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
This patch fixes a read of uninitialized memory in array_out(). The code
was previously doing a strlen() on a stack-allocated char array that,
under some code paths, had never been assigned to. The problem doesn't
appear in REL7_4_STABLE, so there's no need for a backport.

I fixed it by initializing dims_str[0] to '\0' circa line 1018 in
current sources. While doing so I couldn't resist the temptation to fix
a few of arrayfunc.c's crimes against good programming practise, so the
attached patch includes some additional cosmetic improvements. If people
prefer I can just apply the bugfix to HEAD, and save the cleanup till we
branch for 8.1. Comments?

Barring any objections, I'll apply the patch within 24 hours.


Attachment: array-fix-1.patch
Description: text/x-patch (7.5 KB)


pgsql-patches by date

Next:From: Neil ConwayDate: 2004-09-15 09:46:43
Subject: cosmetic pl/pgsql fix
Previous:From: Alvaro HerreraDate: 2004-09-15 01:47:22
Subject: Yet another pair of spanish translation updates

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group