Re: OID from insert has extra letter - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: OID from insert has extra letter
Date
Msg-id 200102061821.NAA04559@candle.pha.pa.us
Whole thread Raw
In response to Re: OID from insert has extra letter  ("Ross J. Reedstrom" <reedstrm@rice.edu>)
Responses Re: OID from insert has extra letter  ("Ross J. Reedstrom" <reedstrm@rice.edu>)
Re: OID from insert has extra letter  (ncm@zembu.com (Nathan Myers))
List 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@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [PATCHES] configure.in patch for readline and curses.
Next
From: "Ross J. Reedstrom"
Date:
Subject: Re: OID from insert has extra letter