From: Vincent Pit Date: Tue, 30 Oct 2012 11:42:48 +0000 (-0200) Subject: Guard against the case where the size is zero X-Git-Tag: v0.02~4 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=79aa4ff6b42ade50fdea796883506f5e424879fc;p=perl%2Fmodules%2FMac-NSGetExecutablePath.git Guard against the case where the size is zero --- diff --git a/NSGetExecutablePath.xs b/NSGetExecutablePath.xs index 93ba9a3..b9ef190 100644 --- a/NSGetExecutablePath.xs +++ b/NSGetExecutablePath.xs @@ -34,7 +34,8 @@ PPCODE: buffer = SvGROW(dst, size); if (_NSGetExecutablePath(buffer, &size)) croak(nsgep_too_long); - SvCUR_set(dst, size - 1); + if (size) + SvCUR_set(dst, size - 1); SvPOK_on(dst); XPUSHs(dst); XSRETURN(1);