Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1ae2feb

Browse files
author
Michael Paquier
committed
Fix inconsistency in call of readlink()
If the target path is too long, an error needs to be emitted as well.The buffer is correctly null-terminated, this will just avoid runninginto weird problems should the target have a too long name.
1 parentb84334b commit1ae2feb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎dir.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,13 @@ dir_list_file_internal(parray *files, const char *root, const char *exclude[],
292292
charlinked[MAXPGPATH];
293293

294294
len=readlink(file->path,linked,sizeof(linked));
295-
if (len==-1)
296-
{
295+
if (len<0)
297296
elog(ERROR,"cannot read link \"%s\": %s",file->path,
298297
strerror(errno));
299-
}
298+
if (len >=sizeof(linked))
299+
elog(ERROR,"symbolic link \"%s\" target is too long\n",
300+
file->path);
301+
300302
linked[len]='\0';
301303
file->linked=pgut_strdup(linked);
302304

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp