bug: chmod() and chown() return values silently ignored in metadata restore #31

Closed
opened 2026-07-20 14:57:41 +02:00 by TapTap · 0 comments
Owner

In src/shared/metadata.c, the return values of security-critical system calls are silently discarded:

Line 99: chmod() return value ignored

chmod(path, metadata->mode & 07777);

Line 100-101: chown() return value explicitly suppressed

int chown_ret = chown(path, metadata->uid, metadata->gid);
(void)chown_ret;

This means:

  1. If chmod fails (e.g., permission denied, read-only filesystem), the operation silently continues with incorrect permissions
  2. If chown fails (e.g., not running as root), the operation silently continues with wrong ownership
  3. Users will not be notified that metadata restoration failed, which could lead to security issues (wrong file permissions)

Fix: Check return values and log warnings/errors when metadata restoration fails.

Severity: high

In `src/shared/metadata.c`, the return values of security-critical system calls are silently discarded: **Line 99:** `chmod()` return value ignored ```c chmod(path, metadata->mode & 07777); ``` **Line 100-101:** `chown()` return value explicitly suppressed ```c int chown_ret = chown(path, metadata->uid, metadata->gid); (void)chown_ret; ``` This means: 1. If `chmod` fails (e.g., permission denied, read-only filesystem), the operation silently continues with incorrect permissions 2. If `chown` fails (e.g., not running as root), the operation silently continues with wrong ownership 3. Users will not be notified that metadata restoration failed, which could lead to security issues (wrong file permissions) **Fix:** Check return values and log warnings/errors when metadata restoration fails. **Severity:** high
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#31