|
@@ -3374,10 +3374,10 @@ format_hex_number_for_helper_exit_status(unsigned int x, char *buf,
|
|
|
* <b>hex_errno</b>. Called between fork and _exit, so must be signal-handler
|
|
|
* safe.
|
|
|
*
|
|
|
- * <b>hex_errno</b> must have at least HEX_ERRNO_SIZE bytes available.
|
|
|
+ * <b>hex_errno</b> must have at least HEX_ERRNO_SIZE+1 bytes available.
|
|
|
*
|
|
|
* The format of <b>hex_errno</b> is: "CHILD_STATE/ERRNO\n", left-padded
|
|
|
- * with spaces. Note that there is no trailing \0. CHILD_STATE indicates where
|
|
|
+ * with spaces. CHILD_STATE indicates where
|
|
|
* in the processs of starting the child process did the failure occur (see
|
|
|
* CHILD_STATE_* macros for definition), and SAVED_ERRNO is the value of
|
|
|
* errno when the failure occurred.
|
|
@@ -3456,8 +3456,8 @@ format_helper_exit_status(unsigned char child_state, int saved_errno,
|
|
|
left -= written;
|
|
|
cur += written;
|
|
|
|
|
|
-
|
|
|
- if (left <= 0)
|
|
|
+
|
|
|
+ if (left <= 1)
|
|
|
goto err;
|
|
|
|
|
|
|
|
@@ -3712,7 +3712,7 @@ tor_spawn_background(const char *const filename, const char **argv,
|
|
|
this is used for printing out the error message */
|
|
|
unsigned char child_state = CHILD_STATE_INIT;
|
|
|
|
|
|
- char hex_errno[HEX_ERRNO_SIZE];
|
|
|
+ char hex_errno[HEX_ERRNO_SIZE + 1];
|
|
|
|
|
|
static int max_fd = -1;
|
|
|
|