mkinitrd unification across distributions
 help / color / mirror / Atom feed
From: Kamil Rytarowski <n54-KK0ffGbhmjU@public.gmane.org>
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] Introduce stricter type-correctness
Date: Sat, 11 May 2013 17:14:32 +0200	[thread overview]
Message-ID: <518E6058.8070300@gmx.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 262 bytes --]

Hello,

I'm attaching a patch introducing stricter type-correctness.
Most of the changes are fixing issues with operating over signed with 
unsigned types. One of the changes aims to fix an insecure passing of a 
character* buffer through a parameter.

Regards,

[-- Attachment #2: 0001-Introduce-stricter-type-correctness.patch --]
[-- Type: text/x-patch, Size: 2190 bytes --]

From 66ba27f0dc3cdb3edf4fe4e04d2e23c348294bc5 Mon Sep 17 00:00:00 2001
From: Kamil Rytarowski <n54-KK0ffGbhmjU@public.gmane.org>
Date: Sat, 11 May 2013 17:06:45 +0200
Subject: [PATCH] Introduce stricter type correctness

---
 install/dracut-install.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/install/dracut-install.c b/install/dracut-install.c
index 3b86256..84703ad 100644
--- a/install/dracut-install.c
+++ b/install/dracut-install.c
@@ -80,9 +80,9 @@ static char *convert_abs_rel(const char *from, const char *target)
         _cleanup_free_ char *realtarget = NULL;
         _cleanup_free_ char *target_dir_p = NULL, *realpath_p = NULL;
         const char *realfrom = from;
-        int level = 0, fromlevel = 0, targetlevel = 0;
-        int l, i, rl;
-        int dirlen;
+        size_t level = 0, fromlevel = 0, targetlevel = 0;
+        int l;
+        size_t i, rl, dirlen;
         int ret;
 
         target_dir_p = strdup(target);
@@ -220,7 +220,7 @@ static int cp(const char *src, const char *dst)
                 if (ret == 0) {
                         struct timeval tv[2];
                         if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0)
-                                fchown(dest_desc, -1, sb.st_gid);
+                                fchown(dest_desc, (__uid_t)-1, sb.st_gid);
                         tv[0].tv_sec = sb.st_atime;
                         tv[0].tv_usec = 0;
                         tv[1].tv_sec = sb.st_mtime;
@@ -305,7 +305,7 @@ static int resolve_deps(const char *src)
                 log_debug("ldd: '%s'", buf);
 
                 if (strstr(buf, "you do not have execution permission")) {
-                        log_error(buf);
+                        log_error("%s", buf);
                         ret+=1;
                         break;
                 }
@@ -705,7 +705,7 @@ static int parse_argv(int argc, char *argv[])
 static int resolve_lazy(int argc, char **argv)
 {
         int i;
-        int destrootdirlen = strlen(destrootdir);
+        size_t destrootdirlen = strlen(destrootdir);
         int ret = 0;
         char *item;
         for (i = 0; i < argc; i++) {
-- 
1.8.1.5


             reply	other threads:[~2013-05-11 15:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-11 15:14 Kamil Rytarowski [this message]
     [not found] ` <518E6058.8070300-KK0ffGbhmjU@public.gmane.org>
2013-05-28 12:38   ` [PATCH] Introduce stricter type-correctness Harald Hoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=518E6058.8070300@gmx.com \
    --to=n54-kk0ffgbhmju@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox