Closed
Bug 1493155
Opened 6 years ago
Closed 5 years ago
strncpy output truncated - warning
Categories
(NSPR :: NSPR, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
4.22
People
(Reporter: alexander.m.scheel, Assigned: alexander.m.scheel)
References
Details
Attachments
(1 file)
594 bytes,
patch
|
jcj
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36 Steps to reproduce: 1. Followed build instructions in JSS for building with upstream NSPR and NSS -- https://github.com/dogtagpki/jss -- (1)(a) 2. Looked at the output during the NSPR build. 3. Look at NSPR upstream source to verify that this is valid: https://hg.mozilla.org/projects/nspr/file/tip/config/nsinstall.c#l520 Actual results: Received a warning about strncpy truncation: cc -o nsinstall.o -c -Wall -pthread -g -fno-inline -fPIC -UNDEBUG -DDEBUG_jss -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DDEBUG=1 -DHAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1 -DHAVE_VISIBILITY_PRAGMA=1 -DXP_UNIX=1 -D_GNU_SOURCE=1 -DHAVE_FCNTL_FILE_LOCKING=1 -DHAVE_POINTER_LOCALTIME_R=1 -DLINUX=1 -DHAVE_DLADDR=1 -DHAVE_LCHOWN=1 -DHAVE_SETPRIORITY=1 -DHAVE_STRERROR=1 -DHAVE_SYSCALL=1 -DHAVE_SECURE_GETENV=1 -D_REENTRANT=1 -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM ../../config/nsinstall.c ../../config/nsinstall.c: In function ‘reversepath’: ../../config/nsinstall.c:520:6: warning: ‘strncpy’ output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation] strncpy(cp, "../", 3); ^~~~~~~~~~~~~~~~~~~~~ cc nsinstall.o -o nsinstall Expected results: No warning about strcpy; this can be fixed by switching to memcpy. This was discovered while reviewing and fixing a similar issue in jss code. It appears that nss had previously published this fix as well: https://bugzilla.mozilla.org/show_bug.cgi?id=1438426 JSS issue: https://pagure.io/jss/issue/21 JSS PR: https://github.com/dogtagpki/jss/pull/24 Apologies if the patch is in the wrong format -- it is my first time submitting a patch with hg. :)
Comment 1•5 years ago
|
||
Comment on attachment 9010934 [details] [diff] [review] nspr-strncpy-memcpy.patch Review of attachment 9010934 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me, thank you!
Attachment #9010934 -
Flags: review+
Updated•5 years ago
|
Assignee: nobody → alexander.m.scheel
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
QA Contact: jjones
Comment 2•5 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.22
You need to log in
before you can comment on or make changes to this bug.
Description
•