]> granicus.if.org Git - spl/commitdiff
Fix a small corner case in the test infrastructure where
authorbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>
Tue, 4 Nov 2008 23:38:29 +0000 (23:38 +0000)
committerbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>
Tue, 4 Nov 2008 23:38:29 +0000 (23:38 +0000)
we might end up with a non-NULL terminated buffer if the
test name or desc is too long.  Only copy N-1 bytes.

git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@173 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c

modules/splat/splat-internal.h

index bda56f1bc7b840b1a8ebfdfa9faad7c9894b0afd..c98201dfdbc97487f01c86953fc4497290d8dfdb 100644 (file)
                printk(KERN_ERR "splat: Error initializing: " n "/" #tid" \n");\
        } else {                                                        \
                memset(_test_, 0, sizeof(*_test_));                     \
-               strncpy(_test_->desc.name, n, SPLAT_NAME_SIZE);         \
-               strncpy(_test_->desc.desc, d, SPLAT_DESC_SIZE);         \
+               strncpy(_test_->desc.name, n, SPLAT_NAME_SIZE-1);       \
+               strncpy(_test_->desc.desc, d, SPLAT_DESC_SIZE-1);       \
                _test_->desc.id = tid;                                  \
                _test_->test = func;                                    \
                INIT_LIST_HEAD(&(_test_->test_list));                   \