Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syscall arguments are neveger negative #7

Open
randomstuff opened this issue Jun 25, 2015 · 2 comments
Open

Syscall arguments are neveger negative #7

randomstuff opened this issue Jun 25, 2015 · 2 comments
Labels

Comments

@randomstuff
Copy link
Collaborator

The arguments are defined as unsigned long:

typedef struct open_arg_s {
  unsigned long ret;
  unsigned long ptr_filename;
  unsigned long flags;
  unsigned long mode;
} open_arg_s;

However the code has a lot of tests for negativeness:

if (arg->ret >= 0) {
  // This is always executed
}
@mquinson
Copy link
Owner

In strace, the result of syscalls is a long: http://sources.debian.net/src/strace/4.10-1/defs.h/#L226

(unless I'm missing something)

@randomstuff
Copy link
Collaborator Author

Well we should either define the fields as (signed) long or cast them when checking for negativeness. Or use the correct type: for open, int might be enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants