Author: iratqq
Date: Sun Mar  2 06:43:11 2008
New Revision: 5269

Modified:
  trunk/uim/prime.c
  trunk/uim/uim-helper.c

Log:
* uim/uim-helper.c (uim_helper_get_pathname):
 - Replace snprintf->strlcat.
* uim/prime.c (prime_get_ud_path):
 - Ditto.


Modified: trunk/uim/prime.c
==============================================================================
--- trunk/uim/prime.c   (original)
+++ trunk/uim/prime.c   Sun Mar  2 06:43:11 2008
@@ -113,24 +113,22 @@
static uim_bool
prime_get_ud_path(char *prime_path, int len)
{
-  char socket_path[MAXPATHLEN], ud_path[MAXPATHLEN];
-
  if (len <= 0)
    return UIM_FALSE;

- if (!uim_get_config_path(ud_path, sizeof(ud_path), !uim_helper_is_setugid())) {
+  if (!uim_get_config_path(prime_path, len, !uim_helper_is_setugid())) {
    prime_path[0] = '\0';
    return UIM_FALSE;
  }

-  snprintf(socket_path, len, "%s/socket", ud_path);
+  strlcat(prime_path, "/socket", len);

-  if (!uim_check_dir(socket_path)) {
+  if (!uim_check_dir(prime_path)) {
    prime_path[0] = '\0';
    return UIM_FALSE;
  }

-  snprintf(prime_path, len, "%s/uim-prime", socket_path);
+  strlcat(prime_path, "/uim-prime", len);

  return UIM_TRUE;
}

Modified: trunk/uim/uim-helper.c
==============================================================================
--- trunk/uim/uim-helper.c      (original)
+++ trunk/uim/uim-helper.c      Sun Mar  2 06:43:11 2008
@@ -167,7 +167,6 @@
uim_bool
uim_helper_get_pathname(char *helper_path, int len)
{
-  char socket_path[MAXPATHLEN], ud_path[MAXPATHLEN];
  struct passwd *pw;

  if (len <= 0)
@@ -186,26 +185,27 @@
    return UIM_FALSE;
  }

-  snprintf(ud_path, len, "%s/.uim.d", pw->pw_dir);
+  strlcpy(helper_path, pw->pw_dir, len);
+  strlcat(helper_path, "/.uim.d", len);
  endpwent();

  /* check ~/.uim.d/ */
-  if (!check_dir(ud_path)) {
+  if (!check_dir(helper_path)) {
    uim_fatal_error("uim_helper_get_pathname()");
    helper_path[0] = '\0';
    return UIM_FALSE;
  }

  /* check ~/.uim.d/socket/ */
-  snprintf(socket_path, sizeof(socket_path), "%s/socket", ud_path);
+  strlcat(helper_path, "/socket", len);

-  if (!check_dir(socket_path)) {
+  if (!check_dir(helper_path)) {
    uim_fatal_error("uim_helper_get_pathname()");
    helper_path[0] = '\0';
    return UIM_FALSE;
  }

-  snprintf(helper_path, len, "%s/uim-helper", socket_path);
+  strlcat(helper_path, "/uim-helper", len);

  UIM_CATCH_ERROR_END();

Reply via email to