X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=udev_rules_parse.c;h=be0757374e216f2e2822e75c955c83a49a7b138f;hp=0259268c8faa36b0ce8e7327c844798d4d7c12e0;hb=fa5c98ab9c9fa86e7078011c6c95597b74be2103;hpb=594dd610252923591ed0f310695e82d3fb87e581 diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 0259268c8..be0757374 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -1,12 +1,9 @@ /* * udev_rules_parse.c * - * Userspace devfs - * * Copyright (C) 2003,2004 Greg Kroah-Hartman * Copyright (C) 2003-2005 Kay Sievers * - * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation version 2 of the License. @@ -241,6 +238,7 @@ static int add_to_rules(struct udev_rules *rules, char *line) int valid; char *linepos; char *attr; + size_t padding; int retval; /* get all the keys */ @@ -506,6 +504,11 @@ static int add_to_rules(struct udev_rules *rules, char *line) /* grow buffer and add rule */ rule_size = sizeof(struct udev_rule) + rule->bufsize; + padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t); + dbg("add %zi padding bytes", padding); + rule_size += padding; + rule->bufsize += padding; + rules->buf = realloc(rules->buf, rules->bufsize + rule_size); if (!rules->buf) { err("realloc failed");