You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Emmanuel Lécharny (Jira)" <ji...@apache.org> on 2025/12/07 22:03:00 UTC
[jira] [Commented] (DIRSERVER-2424) Possible Null pointer dereference in LdifPartition
[ https://issues.apache.org/jira/browse/DIRSERVER-2424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18043405#comment-18043405 ]
Emmanuel Lécharny commented on DIRSERVER-2424:
----------------------------------------------
There will always be a parent, as the partition is created in the {{doInit()}} function.
However, a check for null isn't a bad idea.
> Possible Null pointer dereference in LdifPartition
> --------------------------------------------------
>
> Key: DIRSERVER-2424
> URL: https://issues.apache.org/jira/browse/DIRSERVER-2424
> Project: Directory ApacheDS
> Issue Type: Bug
> Components: ldif
> Affects Versions: 2.0.0.AM27
> Reporter: Mikhail Titov
> Priority: Major
>
> Method [ldifFile.getParentFile()|https://github.com/apache/directory-server/blob/5f01dc406ff24892164849c73a34b1781b0f6a26/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java#L341] can return Null if this pathname does not name a parent, so an [attempt to access null|https://github.com/apache/directory-server/blob/5f01dc406ff24892164849c73a34b1781b0f6a26/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java#L343] can lead to NPE and UB.
> (Oracle Docs): [getParentFile()|https://docs.oracle.com/javase/8/docs/api/java/io/File.html#getParentFile--].
> In the [tests for the deletion method|https://github.com/apache/directory-server/blob/5f01dc406ff24892164849c73a34b1781b0f6a26/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java#L290-L467], no checks were found for root directories or incorrect paths.
> Perhaps I made a mistake and such ways should not be considered, I would love to discuss this point.
> I would suggest adding a check in case the parentFile is not found.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@directory.apache.org
For additional commands, e-mail: dev-help@directory.apache.org