add some more error checks into _fileExistsInDirectory function to report "too long name" error

From: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: add some more error checks into _fileExistsInDirectory function to report "too long name" error
Date: 2025-04-11 12:26:40
Message-ID: CAKYtNApPmWmU9rdf__D=cA7ivL6H_UrPc=w0CHW74P2acxJJ-g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
In another thread[1], Álvaro gave some feedback for _fileExistsInDirectory
function for "too long name" error.
Basically, in _fileExistsInDirectory function, we pass dirname and filename
but we were checking only the combined length of these two names.

Here, I am attaching a patch which will check lengths of dirname and
filename separately and will report errors if the name is too long.

I added a check in some other parts also to report an error for "too long
name".

Please review the attached patch and let me know feedback.

[1]:
https://www.postgresql.org/message-id/202504110938.4kx73ylnv6p4%40alvherre.pgsql

--
Thanks and Regards
Mahendra Singh Thalor
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
v01-add-some-more-error-checks-into-_fileExistsInDirecto.patch application/octet-stream 6.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mahendra Singh Thalor 2025-04-11 12:30:02 Re: merge file_exists_in_directory and _fileExistsInDirectory functions and move into common file dumputils.c
Previous Message Ranier Vilela 2025-04-11 12:16:20 Re: Silence resource leaks alerts