Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-4848

Possible stack overflow in setup_random

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.8.4, 3.9.2
    • None
    • c client

    Description

      Created for https://github.com/apache/zookeeper/pull/2097.

              int seed_len = 0;
              /* Enter a loop to fill in seed with random data from /dev/urandom.
               * This is done in a loop so that we can safely handle short reads
               * which can happen due to signal interruptions.
               */
              while (seed_len < sizeof(seed)) {
                  /* Assert we either read something or we were interrupted due to a
                   * signal (errno == EINTR) in which case we need to retry.
                   */
                  int rc = read(fd, &seed + seed_len, sizeof(seed) - seed_len);
                  assert(rc > 0 || errno == EINTR);
                  if (rc > 0) {
                      seed_len += rc;
                  }
              }
      

      Above code will overflow seed in case of a short read.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kezhuw Kezhu Wang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m