chiark / gitweb /
util: unify how we see srand()
[elogind.git] / src / udev / cdrom_id / cdrom_id.c
index c93a7bf8d13180d3de4d67733d67faa663e67682..5fe3fb535b40bf56405e6671509dc9baba606455 100644 (file)
@@ -606,7 +606,7 @@ static int cd_profiles(struct udev *udev, int fd)
                 switch (feature) {
                 case 0x00:
                         log_debug("GET CONFIGURATION: feature 'profiles', with %i entries", features[i+3] / 4);
-                        feature_profiles(udev, &features[i]+4, features[i+3]);
+                        feature_profiles(udev, &features[i]+4, MIN(features[i+3], len - i - 4));
                         break;
                 default:
                         log_debug("GET CONFIGURATION: feature 0x%04x <ignored>, with 0x%02x bytes", feature, features[i+3]);
@@ -922,7 +922,7 @@ int main(int argc, char *argv[])
                 goto exit;
         }
 
-        srand((unsigned int)getpid());
+        initialize_srand();
         for (cnt = 20; cnt > 0; cnt--) {
                 struct timespec duration;