function::user_buffer_quoted - Linux


user_buffer_quoted lets you access the portion of a buffer designated for use by calls to __builtin_libcall function as a pointer to a null-terminated string.


char* __function_user_buffer_quoted(int function_code, ...)




  1. Getting the buffer pointer for read():

    char* buffer = __read_user_buffer_quoted(4);
  2. Getting the buffer pointer for open():

    char* buffer = __open_user_buffer_quoted(5);

Common Issues

  1. Incorrect function code: Ensure you provide the correct function code corresponding to the desired system call. Incorrect codes will result in unexpected behavior or segmentation faults.
  2. Invalid arguments: Passing invalid arguments to the system call can lead to errors or undefined behavior. Double-check your arguments before making the call.


user_buffer_quoted is commonly used in conjunction with other Linux system call wrappers to access user-space buffers. Here’s an example with __builtin_libcall read():

#include <sys/syscall.h>

int main() {
  char buffer[512];
  long bytes_read = __builtin_libcall(_read, 0, buffer, sizeof(buffer));
  // Do something with the data in buffer
  return 0;

Related Commands

  • read(2)
  • open(2)
  • memset(3)