Xinqi Bao's Git
projects
/
dmenu.git
/ commitdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
dd2f298
)
fix possible overflow
author
Connor Lane Smith <
[email protected]
>
Mon, 16 May 2011 22:35:14 +0000
(23:35 +0100)
committer
Connor Lane Smith <
[email protected]
>
Mon, 16 May 2011 22:35:14 +0000
(23:35 +0100)
dmenu.c
patch
|
blob
|
history
diff --git
a/dmenu.c
b/dmenu.c
index
a32131c
..
c4b7908
100644
(file)
--- a/
dmenu.c
+++ b/
dmenu.c
@@
-31,7
+31,7
@@
static void grabkeyboard(void);
static void insert(const char *str, ssize_t n);
static void keypress(XKeyEvent *ev);
static void match(Bool sub);
static void insert(const char *str, ssize_t n);
static void keypress(XKeyEvent *ev);
static void match(Bool sub);
-static size_t nextrune(int inc
r
);
+static size_t nextrune(int inc);
static void paste(void);
static void readstdin(void);
static void run(void);
static void paste(void);
static void readstdin(void);
static void run(void);
@@
-426,10
+426,10
@@
match(Bool sub) {
}
size_t
}
size_t
-nextrune(int inc
r
) {
- s
ize_t n, len = strlen(text)
;
+nextrune(int inc) {
+ s
size_t n
;
- for(n = cursor + inc
r; n < len && (text[n] & 0xc0) == 0x80; n += incr
);
+ for(n = cursor + inc
; n + inc >= 0 && (text[n] & 0xc0) == 0x80; n += inc
);
return n;
}
return n;
}