[hackers] [libixp] Fixed a bug that ostensibly prevented one from walking 4 directories deep.

From: Kris Maglione <jg_AT_suckless.org>
Date: Sun Mar 18 00:00:24 2007

changeset: 48:3c5a0bfbc208
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sat Mar 17 18:57:43 2007 -0400
summary: Fixed a bug that ostensibly prevented one from walking 4 directories deep.

diff -r f4331abd352f -r 3c5a0bfbc208 convert.c
--- a/convert.c Fri Mar 16 02:04:29 2007 -0400
+++ b/convert.c Sat Mar 17 18:57:43 2007 -0400
@@ -3,6 +3,7 @@
  */
 #include "ixp.h"
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 
 /* packode/unpackode stuff */
@@ -93,15 +94,19 @@ ixp_pack_string(uchar **msg, int *msize,
 
 void
 ixp_unpack_strings(uchar **msg, int *msize, ushort n, char **strings) {
- uchar *s = *msg;
- uint i, size = 0;
+ uchar *s;
+ uint i, size;
         ushort len;
+
+ size = *msize;
+ s = *msg;
         for(i=0; i<n; i++) {
- ixp_unpack_u16(&s, msize, &len);
+ ixp_unpack_u16(&s, &size, &len);
                 s += len;
- size += len + 1; /* for '\0' */
- }
- if(!size) {
+ size -= len;
+ }
+ if((size <= 0)
+ || (size = *msize - size) == 0) {
                 /* So we don't try to free some random value */
                 *strings = NULL;
                 return;
Received on Sun Mar 18 2007 - 00:00:24 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:56:19 UTC