# Extended 4.1 — src/client.c → setImageName(NULL) crash on realpath failure

Bug ref      : pharo.md §4.1
Severity     : HIGH (SEGV during VM init on permission/missing-component errors)
File         : src/client.c (~222-225), src/utils.c (setImageName/setVMPath)

## Problem

```c
char* fullImageName = alloca(FILENAME_MAX);
fullImageName = getFullPath(fileName, fullImageName, FILENAME_MAX);
setImageName(fullImageName);
```

`getFullPath` wraps `realpath`, which returns NULL on permission or
missing-component errors. `setImageName` then `strcpy`s from NULL,
which SEGVs during VM init.

The same pattern exists at `parameters/parameters.c:751-755` for
`setVMPath`.

## Fix

`setImageName`/`setVMPath`/`setVMName` should already be safe
against NULL after extended/3.10 lands (snprintf rejects NULL).
For belt-and-braces, also check at the caller before calling:

```diff
--- a/src/client.c
+++ b/src/client.c
@@ -222,7 +222,11 @@
     char* fullImageName = alloca(FILENAME_MAX);
 	fullImageName = getFullPath(fileName, fullImageName, FILENAME_MAX);
 
-    setImageName(fullImageName);
+    if (fullImageName == NULL) {
+        logError("Cannot resolve image name '%s'", fileName);
+        return false;
+    }
+    setImageName(fullImageName);
 
     return 1;
 }
```

Apply the same fix at parameters/parameters.c:751-755 (the setVMPath
call site).

## Test plan

- Pass an image filename whose realpath fails (e.g. a directory
  with restrictive permissions, or a path with a missing
  component). Before: SEGV inside setImageName. After: clean error
  and the VM exits with code != 0.
- Normal startup: unchanged behaviour.

## Risk notes

- Combined with extended/3.10 this fix is belt-and-braces; either
  alone catches the NULL but the caller-side check provides a
  better error message.
