Problems with using execvp on a constructed string

前端 未结 3 1813
别跟我提以往
别跟我提以往 2021-01-21 12:42

I\'m trying to write a shell, and part of its construction is executing code from a user-inputted string (buffer). However, when I attempt to execvp the string with additional i

3条回答
  •  生来不讨喜
    2021-01-21 13:04

    Two problems:

    1. You are passing an uninitialized string to the first strcat.
    2. execvp expects an array of strings, not a single string with null-separated fields.

提交回复
热议问题