* [hail patch 1/1] fix hstor crashes
@ 2010-07-08 0:21 Pete Zaitcev
2010-07-08 0:44 ` Jeff Garzik
0 siblings, 1 reply; 2+ messages in thread
From: Pete Zaitcev @ 2010-07-08 0:21 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Project Hail List
This patch addresses two bugs:
- No parameters to search worked (because character '=' was missing,
e.g. delim/ instead of delim=/), and also there were weird truncations
because prefix can easily be longer than 32 characters.
- If prefix is empty, xmlNodeListGetString returns NULL instead of "",
thus segfault in strdup. This is not easy to accomplish with Boto,
but our own httpstor can do it.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
---
lib/hstor.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
This patch was actually tested on httpstor, I've not switched to hstor
yet, but it seems to apply 100%. There's no sense in fixing httpstor,
I'm going to delete it from tabled soon.
diff --git a/lib/hstor.c b/lib/hstor.c
index 403aca3..5dfff27 100644
--- a/lib/hstor.c
+++ b/lib/hstor.c
@@ -621,13 +621,13 @@ bool hstor_del(struct hstor_client *hstor, const char *bucket, const char *key)
static GString *append_qparam(GString *str, const char *key, const char *val,
char *arg_char)
{
- char *stmp, s[32];
+ char *stmp;
str = g_string_append(str, arg_char);
arg_char[0] = '&';
- sprintf(s, "%s=", key);
str = g_string_append(str, key);
+ str = g_string_append(str, "=");
stmp = huri_field_escape(strdup(val), QUERY_ESCAPE_MASK);
str = g_string_append(str, stmp);
@@ -868,7 +868,7 @@ struct hstor_keylist *hstor_keys(struct hstor_client *hstor, const char *bucket,
}
else if (!_strcmp(node->name, "Prefix")) {
xs = xmlNodeListGetString(doc, node->children, 1);
- keylist->prefix = strdup((char *)xs);
+ keylist->prefix = strdup(xs? (char *)xs: "");
xmlFree(xs);
}
else if (!_strcmp(node->name, "Marker")) {
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [hail patch 1/1] fix hstor crashes
2010-07-08 0:21 [hail patch 1/1] fix hstor crashes Pete Zaitcev
@ 2010-07-08 0:44 ` Jeff Garzik
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2010-07-08 0:44 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: Project Hail List
On 07/07/2010 08:21 PM, Pete Zaitcev wrote:
> This patch addresses two bugs:
>
> - No parameters to search worked (because character '=' was missing,
> e.g. delim/ instead of delim=/), and also there were weird truncations
> because prefix can easily be longer than 32 characters.
>
> - If prefix is empty, xmlNodeListGetString returns NULL instead of "",
> thus segfault in strdup. This is not easy to accomplish with Boto,
> but our own httpstor can do it.
>
> Signed-off-by: Pete Zaitcev<zaitcev@redhat.com>
>
> ---
> lib/hstor.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> This patch was actually tested on httpstor, I've not switched to hstor
> yet, but it seems to apply 100%. There's no sense in fixing httpstor,
> I'm going to delete it from tabled soon.
applied
Check out 'libhail-merge' branch of tabled.git, it should have already
fixed up the issues and the delete.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-08 0:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-08 0:21 [hail patch 1/1] fix hstor crashes Pete Zaitcev
2010-07-08 0:44 ` Jeff Garzik
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.