<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks, Ludwig. I've just committed your patch to CVS.<br>
<br>
Ludwig Nussel wrote:
<blockquote cite="mid200612121153.13584.ludwig.nussel@suse.de"
 type="cite">
  <pre wrap="">Hi,

gcc warns about some wrong uses of strncat, attached patch fixes
them in loki_setupdb. strncpy is not used correctly either but
well...

cu
Ludwig

  </pre>
  <pre wrap="">
<hr size="4" width="90%">
Index: loki_setupdb/convert.c
===================================================================
--- loki_setupdb.orig/convert.c
+++ loki_setupdb/convert.c
@@ -36,8 +36,8 @@ const char *get_path(const char *path)
         strncpy(buf, path, sizeof(buf));
     } else {
         getcwd(buf, sizeof(buf));
-        strncat(buf, "/", sizeof(buf));
-        strncat(buf, path, sizeof(buf));
+        strncat(buf, "/", sizeof(buf)-strlen(buf)-1);
+        strncat(buf, path, sizeof(buf)-strlen(buf)-1);
     }
     ptr = strrchr(buf, '/');
     if ( ptr ) {
Index: loki_setupdb/setupdb.c
===================================================================
--- loki_setupdb.orig/setupdb.c
+++ loki_setupdb/setupdb.c
@@ -646,11 +646,11 @@ product_t *loki_create_product(const cha
         snprintf(homefile, sizeof(homefile), "%s/" LOKI_DIRNAME, detect_home());
         mkdir(homefile, 0700);
 
-        strncat(homefile, "/installed", sizeof(homefile)-strlen(homefile));
+        strncat(homefile, "/installed", sizeof(homefile)-strlen(homefile)-1);
         mkdir(homefile, 0700);
 
-        strncat(homefile, "/", sizeof(homefile)-strlen(homefile));
-        strncat(homefile, get_xml_base(), sizeof(homefile)-strlen(homefile));
+        strncat(homefile, "/", sizeof(homefile)-strlen(homefile)-1);
+        strncat(homefile, get_xml_base(), sizeof(homefile)-strlen(homefile)-1);
         mkdir(homefile, 0700);
 
         /* Clean up the root - it can't have a trailing slash */
@@ -667,13 +667,13 @@ product_t *loki_create_product(const cha
         return NULL;
     }
 
-        strncat(homefile, "/", sizeof(homefile)-strlen(homefile));
-        strncat(homefile, name, sizeof(homefile)-strlen(homefile));
-        strncat(homefile, ".xml", sizeof(homefile)-strlen(homefile));
-
-        strncat(manifest, "/", sizeof(manifest)-strlen(manifest));
-        strncat(manifest, name, sizeof(manifest)-strlen(manifest));
-        strncat(manifest, ".xml", sizeof(manifest)-strlen(manifest));
+        strncat(homefile, "/", sizeof(homefile)-strlen(homefile)-1);
+        strncat(homefile, name, sizeof(homefile)-strlen(homefile)-1);
+        strncat(homefile, ".xml", sizeof(homefile)-strlen(homefile)-1);
+
+        strncat(manifest, "/", sizeof(manifest)-strlen(manifest)-1);
+        strncat(manifest, name, sizeof(manifest)-strlen(manifest)-1);
+        strncat(manifest, ".xml", sizeof(manifest)-strlen(manifest)-1);
 
 
     /* Symlink the file in the 'installed' per-user directory */
@@ -2258,15 +2258,15 @@ int loki_upgrade_uninstall(product_t *pr
     snprintf(binpath, sizeof(binpath), "%s/" LOKI_DIRNAME "/installed/bin", detect_home());
     mkdir(binpath, 0755);
 
-    strncat(binpath, "/", sizeof(binpath));
-    strncat(binpath, os_name, sizeof(binpath));
+    strncat(binpath, "/", sizeof(binpath)-strlen(binpath)-1);
+    strncat(binpath, os_name, sizeof(binpath)-strlen(binpath)-1);
     mkdir(binpath, 0755);
 
-    strncat(binpath, "/", sizeof(binpath));
-    strncat(binpath, detect_arch(), sizeof(binpath));
+    strncat(binpath, "/", sizeof(binpath)-strlen(binpath)-1);
+    strncat(binpath, detect_arch(), sizeof(binpath)-strlen(binpath)-1);
     mkdir(binpath, 0755);
 
-    strncat(binpath, "/uninstall", sizeof(binpath));
+    strncat(binpath, "/uninstall", sizeof(binpath)-strlen(binpath)-1);
 
     if ( !access(binpath, X_OK) &amp;&amp; !access(src_bins, R_OK) ) {
         char cmd[PATH_MAX];
@@ -2369,7 +2369,7 @@ int loki_upgrade_uninstall(product_t *pr
                                                  lang);
                                 mkdir(binpath, 0755);
                                 
-                                strncat(binpath, "/LC_MESSAGES", sizeof(binpath));
+                                strncat(binpath, "/LC_MESSAGES", sizeof(binpath)-strlen(binpath)-1);
                                 mkdir(binpath, 0755);
 
                                 snprintf(binpath, sizeof(binpath),
  </pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Stephane Peter
<a class="moz-txt-link-abbreviated" href="mailto:megastep@megastep.org">megastep@megastep.org</a>
</pre>
</body>
</html>