[
https://issues.apache.org/jira/browse/HDFS-15922?focusedWorklogId=571977&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-571977
]
ASF GitHub Bot logged work on HDFS-15922:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 25/Mar/21 16:11
Start Date: 25/Mar/21 16:11
Worklog Time Spent: 10m
Work Description: GauthamBanasandra opened a new pull request #2818:
URL: https://github.com/apache/hadoop/pull/2818
* strncpy reports a warning if the
destination string isn't null
terminated.
* The scenario here is that the string
is deliberately not null terminated
since we want to imperatively suffix
a PATH_SEPARATOR at the end.
* Thus, the warning reported by strncpy
even though valid, isn't applicable.
* Hence we replace strncpy with memcpy
which doesn't worry if the string
is null terminated or not.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 571977)
Remaining Estimate: 0h
Time Spent: 10m
> Use memcpy for copying non-null terminated string in jni_helper.c
> -----------------------------------------------------------------
>
> Key: HDFS-15922
> URL: https://issues.apache.org/jira/browse/HDFS-15922
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: libhdfs++
> Affects Versions: 3.4.0
> Reporter: Gautham Banasandra
> Assignee: Gautham Banasandra
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> We currently get a warning while compiling HDFS native client -
> {code}
> [WARNING] inlined from 'wildcard_expandPath' at
> /home/jenkins/jenkins-home/workspace/hadoop-multibranch_PR-2792/src/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jni_helper.c:427:21,
> [WARNING] /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10:
> warning: '__builtin_strncpy' output truncated before terminating nul copying
> as many bytes from a string as its length [-Wstringop-truncation]
> [WARNING]
> /home/jenkins/jenkins-home/workspace/hadoop-multibranch_PR-2792/src/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jni_helper.c:402:43:
> note: length computed here
> {code}
> The scenario here is such that the copied string is deliberately not null
> terminated, since we want to insert a PATH_SEPARATOR ourselves. The warning
> reported by strncpy is valid, but not applicable in this scenario. Thus, we
> need to use memcpy which doesn't mind if the string is null terminated or not.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]