Re: OID from insert has extra letter

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: OID from insert has extra letter
Date: 2001-02-06 18:21:00
Message-ID: 200102061821.NAA04559@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > *** fe-exec.c 2001/01/24 19:43:30 1.98
> > --- fe-exec.c 2001/02/06 02:02:27 1.100
> > ***************
> > *** 2035,2041 ****
> > if (len > 23)
> > len = 23;
> > strncpy(buf, res->cmdStatus + 7, len);
> > ! buf[23] = '\0';
> >
> > return buf;
> > }
> > --- 2035,2041 ----
> > if (len > 23)
> > len = 23;
> > strncpy(buf, res->cmdStatus + 7, len);
> > ! buf[len] = '\0';
> >
> > return buf;
> > }
> >
>
> Hmm, is there some undocumented feature of strncpy that I don't know
> about, where it modifies the passed length variable (which would be hard,
> since it's pass by value)? Otherwise, doesn't this patch just replace
> the constant '23' with the variable 'len', set to 23?

What if len < 23?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ross J. Reedstrom 2001-02-06 18:27:06 Re: OID from insert has extra letter
Previous Message Karel Zak 2001-02-06 18:17:47 Re: Include files for SPI are not installed