This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new e087a29cd4 Fix logic bug spotted by Coverity Scan
e087a29cd4 is described below

commit e087a29cd4e69f1edb838e5a117b4713288c39f3
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Jan 15 10:11:59 2024 +0000

    Fix logic bug spotted by Coverity Scan
---
 .../apache/tomcat/util/digester/ServiceBindingPropertySource.java    | 2 +-
 webapps/docs/changelog.xml                                           | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/java/org/apache/tomcat/util/digester/ServiceBindingPropertySource.java 
b/java/org/apache/tomcat/util/digester/ServiceBindingPropertySource.java
index a96e5d8285..997ce354db 100644
--- a/java/org/apache/tomcat/util/digester/ServiceBindingPropertySource.java
+++ b/java/org/apache/tomcat/util/digester/ServiceBindingPropertySource.java
@@ -139,7 +139,7 @@ public class ServiceBindingPropertySource implements 
IntrospectionUtils.SecurePr
             int length = bytes.length;
 
             if (chomp) {
-                if(length > 1 && bytes[length - 2] == '\r' && bytes[length - 
2] == '\n') {
+                if(length > 1 && bytes[length - 2] == '\r' && bytes[length - 
1] == '\n') {
                     length -= 2;
                 } else if (length > 0) {
                     byte c = bytes[length - 1];
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c5803e3d2f..4f6ead9029 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -113,6 +113,11 @@
         that is no longer included in the JAR. Based on pull request
         <pr>684</pr> by Jendrik Johannes. (markt)
       </fix>
+      <fix>
+        Fix ServiceBindingPropertySource so that trailing <code>\r\n</code>
+        sequences are correctly removed from files containing property values
+        when configured to do so. Bug identified by Coverity Scan. (markt)
+      </fix>
     </changelog>
   </subsection>
 </section>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to