fix divide by zero (#8100)

This commit is contained in:
Srimanta Barua 2017-08-02 15:43:28 +05:30 committed by radare
parent c7b3a1e2e7
commit 7b5de5cb51

View File

@ -14,6 +14,8 @@ int handle_qSupported(libgdbr_t *g) {
if (r_str_startswith (tok, "PacketSize=")) {
// Largest packet size we support is 2048
g->stub_features.pkt_sz = R_MIN (strtoul (tok + strlen ("PacketSize="), NULL, 16), 2048);
// Shouldn't be smaller than 64 (Erroneous 0 etc.)
g->stub_features.pkt_sz = R_MAX (g->stub_features.pkt_sz, 64);
} else if (r_str_startswith (tok, "qXfer:")) {
if (!tok[6]) {
tok = strtok (NULL, ";");