]> git.vpit.fr Git - perl/modules/Mac-NSGetExecutablePath.git/commitdiff
Guard against the case where the size is zero
authorVincent Pit <vince@profvince.com>
Tue, 30 Oct 2012 11:42:48 +0000 (09:42 -0200)
committerVincent Pit <vince@profvince.com>
Tue, 30 Oct 2012 11:42:48 +0000 (09:42 -0200)
NSGetExecutablePath.xs

index 93ba9a301e11539cf01a67680bd70ac91e95881f..b9ef190a3a26ab41e5dfb5d17e335e2922561ae3 100644 (file)
@@ -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);