bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] getauxval: fix crash on systems without HAVE_AUX_VECTOR


From: Samuel Thibault
Subject: [PATCH] getauxval: fix crash on systems without HAVE_AUX_VECTOR
Date: Sat, 2 Apr 2016 12:57:16 +0200
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Systems without HAVE_AUX_VECTOR have GLRO(dl_auxv) == NULL, and
getauxval would thus crash.

* misc/getauxval.c (__getauxval): Check for GLRO(dl_auxv) != NULL before
looping through the list.

diff --git a/misc/getauxval.c b/misc/getauxval.c
index e48f40f..7ba0598 100644
--- a/misc/getauxval.c
+++ b/misc/getauxval.c
@@ -30,9 +30,10 @@ __getauxval (unsigned long int type)
   else if (type == AT_HWCAP2)
     return GLRO(dl_hwcap2);
 
-  for (p = GLRO(dl_auxv); p->a_type != AT_NULL; p++)
-    if (p->a_type == type)
-      return p->a_un.a_val;
+  if (GLRO(dl_auxv) != NULL)
+    for (p = GLRO(dl_auxv); p->a_type != AT_NULL; p++)
+      if (p->a_type == type)
+       return p->a_un.a_val;
 
   __set_errno (ENOENT);
   return 0;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]