This same problem appears to be exploitable as a localhost attack
against the program xterm. This is setuid root on a lot of systems,
and if tgetent(3) has the overflow problems, the same problem can be
exploited there.
On BSD systems, it is likely this could also have been exploited in
systat(8) to gain gid kmem permissions.
I've not confirmed these probelms... I don't write shell code, I just
fix the bugs ;-)