> On 20 Jun 2015, at 22:49, Peter Maydell <peter.mayd...@linaro.org> wrote: > >> as you can see, it tries to use the kernel name as command line, which >> exceeds the application small buffer size. > > It only does that if you didn't specify the arguments the new > way (at least that is the intention).
what if I do not need to specify any arguments at all, and I want the application to know this? > We need to maintain the > old behaviour for back compatibility. ... > On 05 Jun 2015, at 18:23, Peter Maydell <peter.mayd...@linaro.org> wrote: > >> + output_size = strlen(semihosting_get_cmdline()) + 1; > > It looks like semihosting_get_cmdline() can return NULL, > in which case this will blow up, I think. if back compatibility for preserving the bugs was the goal, then it was reached, the new version also crashes in cases where there are no args and no kernel (for example when the image is loaded via GDB). > On 05 Jun 2015, at 23:09, Leon Alrae <leon.al...@imgtec.com> wrote: > > As far as I can tell existing > implementation may also blow up if kernel_filename is NULL, so we retain > the same behaviour. whatever your views regarding compatibility are, here the correct approach is to check the semihosting_get_cmdline() result for NULL, and make TARGET_SYS_GET_CMDLINE return -1 or an empty string. regards, Liviu