When hv.c was in the midst of being refactored recently, I would
occasionally see a null pointer passed as the first argument to
setenv(). The final version doesn't do that but it made me realize a
decent setenv() implementation should handle the null pointer but our
homegrown one was not. The attached patch makes it do so.
--- vms/vms.c;-0 Fri Jul 4 00:05:00 2003
+++ vms/vms.c Fri Nov 21 15:02:36 2003
@@ -714,6 +714,11 @@
$DESCRIPTOR(crtlenv,"CRTL_ENV"); $DESCRIPTOR(clisym,"CLISYM");
$DESCRIPTOR(local,"_LOCAL");
+ if (!lnm) {
+ set_errno(EINVAL); set_vaxc_errno(SS$_IVLOGNAM);
+ return SS$_IVLOGNAM;
+ }
+
for (cp1 = lnm, cp2 = uplnm; *cp1; cp1++, cp2++) {
*cp2 = _toupper(*cp1);
if (cp1 - lnm > LNM$C_NAMLENGTH) {