As you know, sys_open() does not get the size of the file name as a parameter. However, the standard states that the literal string must end with \0 . This is good news, because now we can make a simple loop repeating over the characters of the string, and when we find the character \0 (NULL), we know that we have reached its end.
What a standard procedure, how strlen() does it, and also how strace does it!
C example:
#include <stdio.h> int main() { const char* filename = "/etc/somefile"; int fname_length = 0; for (int i = 0; filename[i] != '\0'; i++) { fname_length++; } printf("Found %d chars in: %s\n", fname_length, filename); return 0; }
Return to your task, you must access the address filename and follow the procedure described by me. This is what you will need to do, and there is no other way.
source share