Commit 7c3e665
committed
fix: avoid nil pointer dereference in shellAction
The shellAction function was calling cmd.Flags() directly multiple times
throughout the function instead of using the flags variable that was already
captured at the beginning (line 72).
In certain execution paths, cmd.Flags() could return nil, causing a panic:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x98 pc=0x...]
This fix changes three locations to consistently use the flags variable:
- Line 164: workDir flag access
- Line 200: shell flag access
- Line 211: preserve-env flag access
Additionally, adds a nil check for inst.Config before accessing it to
prevent similar panics and provide clearer error messages when instances
have configuration errors.
Signed-off-by: Christian Stewart <[email protected]>1 parent b18eed7 commit 7c3e665
1 file changed
+10
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
97 | 103 | | |
98 | 104 | | |
99 | 105 | | |
| |||
155 | 161 | | |
156 | 162 | | |
157 | 163 | | |
158 | | - | |
| 164 | + | |
159 | 165 | | |
160 | 166 | | |
161 | 167 | | |
162 | 168 | | |
163 | 169 | | |
164 | 170 | | |
165 | | - | |
| 171 | + | |
166 | 172 | | |
167 | 173 | | |
168 | 174 | | |
| |||
191 | 197 | | |
192 | 198 | | |
193 | 199 | | |
194 | | - | |
| 200 | + | |
195 | 201 | | |
196 | 202 | | |
197 | 203 | | |
| |||
202 | 208 | | |
203 | 209 | | |
204 | 210 | | |
205 | | - | |
| 211 | + | |
206 | 212 | | |
207 | 213 | | |
208 | 214 | | |
| |||
0 commit comments