apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arsen Chaloyan <achalo...@yahoo.com>
Subject Uninitialized 1 byte copy in apr_filepath_merge()
Date Tue, 30 Mar 2010 08:37:02 GMT
Hi,

One small and pretty harmless, but still issue in the implementation of apr_filepath_merge()
for win32.

Wouldn't it be better to use apr_pstrmemdup() instead of apr_pmemdup() to avoid initialized
1 byte copy. At least, this allows to silence UMC errors memory profilers complain about.

Index: file_io/win32/filepath.c
===================================================================
--- file_io/win32/filepath.c    (revision 929036)
+++ file_io/win32/filepath.c    (working copy)
@@ -949,8 +949,7 @@
         }
     }
 
-    *newpath = apr_pmemdup(p, path, pathlen + 1);
-    (*newpath)[pathlen] = '\0';
+    *newpath = apr_pstrmemdup(p, path, pathlen);
     return APR_SUCCESS;
 }
 
Regards,
Arsen

Mime
View raw message