| From: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Some doubious code in pgstat.c |
| Date: | 2020-11-04 08:55:23 |
| Message-ID: | 20201104.175523.1704166915688949637.horikyota.ntt@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hello.
While updating a patch, I noticed that the replication slot stats
patch (9868167500) put some somewhat doubious codes.
In pgstat_recv_replslot, an assertion like the following exists:
> idx = pgstat_replslot_index(msg->m_slotname, !msg->m_drop);
..
> Assert(idx >= 0 && idx < max_replication_slots);
But the idx should be 0..(max_replication_slots - 1).
In the same function the following code assumes that the given "char
*name" has the length of NAMEDATALEN. It actually is, but that
assumption seems a bit bogus. I think it should use strlcpy instead.
>pgstat_replslot_index(const char *name, bool create_it)
...
> memcpy(&replSlotStats[nReplSlotStats].slotname, name, NAMEDATALEN);
regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center
| Attachment | Content-Type | Size |
|---|---|---|
| pgstat_c_fix.patch | text/x-patch | 844 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Pavel Borisov | 2020-11-04 09:02:52 | Re: Bogus documentation for bogus geometric operators |
| Previous Message | Laurenz Albe | 2020-11-04 08:52:41 | Re: Collation versioning |