You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "Gautham Banasandra (Jira)" <ji...@apache.org> on 2021/03/25 16:05:00 UTC

[jira] [Created] (HDFS-15922) Use memcpy for copying non-null terminated string in jni_helper.c

Gautham Banasandra created HDFS-15922:
-----------------------------------------

             Summary: 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


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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-help@hadoop.apache.org