|
Lines 479-488
dumplease:
Link Here
|
| 479 |
|
479 |
|
| 480 |
nenv = 0; |
480 |
nenv = 0; |
| 481 |
endp = buf + buf_pos; |
481 |
endp = buf + buf_pos; |
|
|
482 |
loginfox("buf %p endp %p", buf, endp); |
| 482 |
for (bufp = buf; bufp < endp; bufp++) { |
483 |
for (bufp = buf; bufp < endp; bufp++) { |
| 483 |
if (*bufp == '\0') |
484 |
if (*bufp == '\0') |
| 484 |
nenv++; |
485 |
nenv++; |
| 485 |
} |
486 |
} |
|
|
487 |
loginfox("nenv %zu envlen %zu", nenv, ctx->script_envlen); |
| 486 |
if (ctx->script_envlen < nenv) { |
488 |
if (ctx->script_envlen < nenv) { |
| 487 |
env = reallocarray(ctx->script_env, nenv + 1, sizeof(*env)); |
489 |
env = reallocarray(ctx->script_env, nenv + 1, sizeof(*env)); |
| 488 |
if (env == NULL) |
490 |
if (env == NULL) |
|
Lines 490-495
dumplease:
Link Here
|
| 490 |
ctx->script_env = env; |
492 |
ctx->script_env = env; |
| 491 |
ctx->script_envlen = nenv; |
493 |
ctx->script_envlen = nenv; |
| 492 |
} |
494 |
} |
|
|
495 |
loginfox("nenv %zu envlen %zu", nenv, ctx->script_envlen); |
| 493 |
bufp = buf; |
496 |
bufp = buf; |
| 494 |
envp = ctx->script_env; |
497 |
envp = ctx->script_env; |
| 495 |
*envp++ = bufp++; |
498 |
*envp++ = bufp++; |
|
Lines 498-503
dumplease:
Link Here
|
| 498 |
if (*bufp == '\0') |
501 |
if (*bufp == '\0') |
| 499 |
*envp++ = bufp + 1; |
502 |
*envp++ = bufp + 1; |
| 500 |
} |
503 |
} |
|
|
504 |
loginfox("buf %p endp %p", buf, endp); |
| 505 |
loginfox("script %p end %p envp %p", ctx->script_env, ctx->script_env + ctx->script_envlen, envp); |
| 506 |
loginfox("diff %zu", envp - ctx->script_env); |
| 501 |
*envp = NULL; |
507 |
*envp = NULL; |
| 502 |
|
508 |
|
| 503 |
return (ssize_t)nenv; |
509 |
return (ssize_t)nenv; |